I'm using the NB api via PHP. The GET/DELETE methods both work but no matter what I try I can not edit or add a new people resource using the client->fetch() function.
The error code is always a 400 no matter how I format the parameters. Please help and don't give me a canned response to the API helper because I've spent 3.5 hours already trying various things in the documentation which is thin to say the least.
Share this post
Showing 11 reactions
Sign in with
Then, to call the function:
where $person is your Person object.
At any rate you may want to revise your PHP quickstart and NOT mention the $client->fetch method if it does in fact not work:
http://nationbuilder.com/php_quickstart
The fetch function takes multiple parameters which allow for setting headers and HTTP Methods but like I said before POST/PUT don’t work. Thanks again for the help.
Here is what I’m doing.
http://pastebin.com/cYXK2MZs
At this point I’m just trying to get the correct output.
This is what I get back
1) What 400 error? A 404 could mean you have the URL wrong (I doubt this is the case since you said Delete/Get were working. 401 could be an auth error; in this case are you using test tokens?
2) Can you put up a gist of your code, if so if might be easier for me to help you debug what is actually going on. Since the calls are working for you via the API explorer its hard for me to know exactly what is going on without seeing the code.