API Stopped working

We upgraded to 1.3.6.4 and the API stopped working

I'm getting this error:
2: Invalid API request signature. Please refer to the documentation.

Any suggestions on how to fix this?
 
Nope, there was no change in the API, none at all actually.
Maybe it's the data you are sending ?
 
The story goes- we had 13.5.8 installed for a long time and used the API for subscriptions.

After a lot of headache we managed to upgrade to 1.3.6.4 but now all the API calls are broken returning those errors.

I got to the point where i know which line of code its failing at
$signatureHash !== $signature
but have no clue how to fix it

Any suggestions on troubleshooting?
 
@Kerry Panchoo - If you reached that point in the code, have you tried to see if the variables that compose the signature string are the same as the ones from when you did the api call ?
Basically, what you send, is what it gets received in the app side ?
 
I checked in there, its getting the public and private keys properly.
From mailwizz it displays both keys and they are correct. They're the same values in the user's API keys and the calling aps. API keys.

The issue seems to be with the hashing:

PHP:
$separator          = count($getParams) > 0 && strpos($requestUrl, '?') !== false ? '&' : '?';
        $signatureString    = strtoupper($request->getRequestType()) . ' ' . $requestUrl . $separator . http_build_query($params, '', '&');
        $signatureHash      = hash_hmac('sha1', $signatureString, $key->private, false);

I saw here: https://forum.mailwizz.com/threads/api-doesnt-work.2162/#post-13650
he says "Just found the solution... I had to add /index.php at the end of the url..."-- I'm not sure if this is appropriate-- should this be tacked on the the end of the requestURL?
 
I saw here: https://forum.mailwizz.com/threads/api-doesnt-work.2162/#post-13650
he says "Just found the solution... I had to add /index.php at the end of the url..."-- I'm not sure if this is appropriate-- should this be tacked on the the end of the requestURL?
If you use clean urls in app, and mailwizz creates the urls without the index.php part, but your API calls target the url with index.php, then you might get the above error, so you should make sure that if you use clean urls, then the api url you use in the sdk must not contain the index.php part in it.
 
sorry for the late reply about this-- it turned out to be a nginx configuration issue, the api headers were getting striped on the way in.
 
Back
Top