Skip to main content

User information is not updated same email (WordPress - API - NationBuilder)

We are not able to update existing user Account (user is registerred only with email address) with additional information (like First Name, Last Name, phone) that will be submitted later using the same email address...

We are inplemented custom form on WordPress website and already integrated with NationBuilder (API based). All new users, who submitted via our form are registerred in NationBuilder. BUT if user will send via form new personal info with the identical email as was registerred - NationBuilder will not update user info (error: user already exist). User's Password in NationBuilder was not created or edited (so do not think this is the issue).

We tried 2 variants http://apiexplorer.nationbuilder.com/nationbuilder#People  , but both are failed.
See below.

Look forward to hearinf any comments.

Regards

---------

Variant 1

$dataBuilder = array (

'person' => array(
'email' => "","last_name" => "Smith", "first_name" =>"Bob" 
));

$token = '3b30b97feea94bf20c31f83eb787d7d86b8a373561925d5b007a6bb6b79848d0';
$url = add_query_arg(
array('access_token' => $token), 'https://beekeepersandbox.nationbuilder.com/api/v1/people/push'
);
$json_data = json_encode($dataBuilder);
$ch = curl_init($url);

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_TIMEOUT, '10');
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: $token", "Content-Type: application/json", "Accept: application/json"));
curl_setopt($ch, CURLOPT_POSTFIELDS, $json_data);
$result = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$content_type = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
if ($curl_error = curl_error($ch)) {
throw new Exception($curl_error, Exception::CURL_ERROR);
} else {
$json_decode = json_decode($result, true);
}
curl_close($ch);
$response = array(
'result' => (null === $json_decode) ? $result : $json_decode,
'code' => $http_code,
'content_type' => $content_type
);

We get empty result without errors.

 

Variant 2

$params = array(
'person' => array(
'email' => '','home_address' => array('country' => 'Germany', 'zip' => '66666' ))
);

$header = array('Authorization:' => $token,'Content-Type:' => 'application/json', 'Accept:' => 'application/json');
$response = $client->fetch($baseApiUrl . '/api/v1/people/push?access_token=myaccesstoken', $params, 'PUT',$header);
print_r($response);

i get the following response

Array
(
[result] => Array
(
[code] => missing_parameters
[message] => Missing Parameters.
[parameters] => Array
(
[0] => person
)

[inner_error] => Array
(
[name] => Api::Error::MissingParameters
[message] => Missing parameters: person
)
)
[code] => 400
[content_type] => application/json
)

Share this post

Showing 1 reaction

How would you tag this suggestion?
Please check your e-mail for a link to activate your account.