Creating subscriber through API fails with "{"status":"error","error":"Page not found."}"

Cheesewhizz

New Member
What am i missing here?

curl -X POST -H "X-MW-TIMESTAMP: 1642763346" -H "x-mw-public-key: keystring" -H "Content-Type: application/x-www-form-urlencoded" https://mailwizzhost123.com/api/index.php/lists/qv508ht02bcfb/subscribers/create -d "EMAIL=email@domain.com&FNAME=leonard&LNAME=pringle"

mailwizz returns:

{"status":"error","error":"Page not found."}

running curl with -vvv shows HTTP/1.1 404

all other api calls ive tried are working fine, but anything related to adding contacts (both create and update) are failing

i have read through the docs repeatedly and also googled and read all the forum posts i could find, i'm stumped currently
 

twisted1919

Administrator
Staff member
why do the API docs say to use subscribers/create?
Sorry, this is a typo on our end.
@ghimes please fix this, the problem is in the documentation of multiple endpoints, they show wrong HTTP method and also wrong endpoints.
A good example is the createUpdate action, which in the docs show:
Code:
GET API-URL/lists/LIST-UNIQUE-ID/subscribers/search-by-email

POST API-URL/lists/LIST-UNIQUE-ID/subscribers/update/SUBSCRIBER-UNIQUE-ID

POST API-URL/lists/LIST-UNIQUE-ID/subscribers/create
But the reality is totally different, see below.

how do i do a create-or-update?
You'll first have to search if the email exists already, then do a create or update:
Code:
GET API-URL/lists/LIST-UNIQUE-ID/subscribers/search-by-email?EMAIL=x

PUT API-URL/lists/LIST-UNIQUE-ID/subscribers/SUBSCRIBER-UNIQUE-ID

POST API-URL/lists/LIST-UNIQUE-ID/subscribers
 

Cheesewhizz

New Member
so making 2 api calls is required just to update a timestamp on an existing record, for instance?
 
Last edited:

twisted1919

Administrator
Staff member
so making 3 api calls is required just to update a timestamp on an existing record, for instance?
No, 2 api calls are required at most. To check if the subscriber is part of a list and then either create or update that record, any aspect of it, not just a timestamp. If you already know the subscriber info, you can directly update it, no need to query its existence, so just a single api call.
 

Cheesewhizz

New Member
No, 2 api calls are required at most. To check if the subscriber is part of a list and then either create or update that record, any aspect of it, not just a timestamp. If you already know the subscriber info, you can directly update it, no need to query its existence, so just a single api call.
fixed the typo, sorry, thanks for your help, i would like to formally request an update-or-create-if-subscriber-doesnt-exist single API call for a future mailwizz release, if at all possible
 
Top