Subscribe API - empty response
I'm using the Sendy API via the SendyPHP php library. I'm testing the subscribe call and I'm getting a 200 (success) response, but the body is blank. The response I think I should get is '1'. But I get nothing. I confirm this when using curl via the command line.
My Sendy installation seems to be working fine from the front end. It's 1.1.9.2 on a CentOS box with PHP 5.3.3.
Can you please explain why I'd be getting an empty response?
This discussion has been closed.
Comments
Hi,
Are you using a third party library? You'll need to contact the third party developer regarding this issue.
You can test if the API on your Sendy installation is working by using Sendy's official example scripts at http://sendy.co/api
If it works but your third party library does not work you'll need to contact the third party developer for support.
Thanks.
Best regards,
Ben
Hi Ben,
I've solved it.
First, to answer your questions, I am using a third party library, SendyPHP. I was able to reproduce the problem with curl on the command line (as in, without the library or any code at all) so I was asking you for some insight to see what was happening on your side.
What fixed it was setting the HTTP header Content-Type to "application/x-www-form-urlencoded". I am planning on discussing this bug with the SendyPHP developer. See https://github.com/JacobBennett/SendyPHP/pull/15.