Hello,
I am trying to create a new person via POST /api/v1/people and getting back 302 response without any other info.
This is the request body:
{"person": { "first_name": "New", "last_name": "Person1", "phone": "1613111222", "email": "[email protected]" } }
Please help!
Share this post
Showing 8 reactions
Sign in with
{
result: "",
code: 302,
content_type: “text\/html”
}
In PHP using the OAuth2 Plugin used in the docs.
$baseApiUrl = ‘https://’.$input[‘nation’].‘.nationbuilder.com?access_token=’ . $nation->accessKey;
$peopleDecoratedInput = array(
‘person’ => array(
‘home_address’ => array(
‘address1’ => $input[‘streetNum’].’ ‘.$input[’street’],
‘city’ => $input[‘city’],
‘state’ => $input[‘state’],
‘zip’ => $input[‘zip’],
‘country_code’ => $input[‘country_code’]
),
‘first_name’ => $input[‘fName’],
‘last_name’ => $input[‘lName’],
‘phone’ => $input[‘phoneNum’],
‘email’ => $input[‘email’],
‘pointPerson’ => $input[‘pointPerson’],
‘support_level’ => $input[‘supportLevel’]
)
);
$response = $client->fetch(
$baseApiUrl . ‘/api/v1/people’,
$peopleDecoratedInput,
‘POST’,
array(‘Content-type’ => ‘application/json’, ‘Accept’ => ‘application/json’),
0
);
For a PUT request: HTTP 200 or HTTP 204 should imply “resource updated successfully”. For a POST 201 should imply “created”
For a DELETE request: HTTP 200 or HTTP 204 should imply “resource deleted successfully”. HTTP 202 can also be returned which would imply that the instruction was accepted by the server and the “resource was marked for deletion”.
I am currently in the process of updating the docs. My apologies for the delay.
Create Endpoint
Document indicates response 200 (actually returns 201)
Update Endpoint
Document indicates response 201 (actually returns 200)