api-library icon indicating copy to clipboard operation
api-library copied to clipboard

API error The response has unexpected status code (0)

Open jcpicot04 opened this issue 4 years ago • 4 comments

Hi! I’m trying to connect with the API using Basic Auth but I’m getting an error 0. It’s not a caché problem, i’m deleting the caché frequently. The full response it’s:

array(1) { [“errors”]=> array(1) { [0]=> array(2) { [“code”]=> int(0) [“message”]=> string(56) "The response has unexpected status code (0). Response: " } } }

That’s my code: Captura

And all good in the config: Captura2

Thanks!

UPDATE: The code return the same error in post/update but works!

It’s not working only for GET method, only returns the 0 error.

Any help? Thanks!


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

jcpicot04 avatar Apr 26 '21 11:04 jcpicot04

Hi,

Same error in here with the basic Contacts API get method. Any suggestions or tips with this issue?

Thank you!

kovkor avatar Jun 02 '21 06:06 kovkor

In the meantime I figured out the problem. Is not Mautic specific but my local development environment. I run Mautic with Mamp and I tried to connect to the API endpoints from Docker container.

@jcpicot04 try to debug the Curl error message from here: lib/Auth/AbstractAuth.php, line 178 and you can see the error message.

kovkor avatar Jun 02 '21 09:06 kovkor

Does anybody got its solution? Referring to @kovkor response, can you please expain as that file is not in Mautic 3.3.3 version

faisalsarfraz avatar Jun 23 '21 15:06 faisalsarfraz

@faisalsarfraz

In my case I put this line temporarily into the file lib/Auth/AbstractAuth.php, line 178 echo 'Curl error: ' . curl_error($curl);

The error message was: Curl error: Could not resolve host: xxxx

kovkor avatar Aug 17 '21 16:08 kovkor