Updates contact using POST.
For every API request you make, you'll need to present the API access key in the HTTP Header as X-API-Key to be authenticated.
Name | Required | Value | Description |
---|---|---|---|
firstname | required | string | Firstname |
lastname | required | string | Lastname |
required | string | ||
phone | optional | string | Phone |
position | optional | string | Position |
$post_params = array();
$post_params['firstname'] = 'Hanne';
$post_params['lastname'] = 'Hansen';
$post_params['email'] = 'hannee.hansen@example.com';
$post_params['phone'] = '1';
$post_params['position'] = 'Kommunikasjonsrådgiver';
$request_url = 'https://api.frontcore.com/v2/customers/:id/contacts';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $request_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_params);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'X-API-Key: {your-api-key}',
'Accept: application/json',
));
$result = curl_exec($ch);
curl_close($ch);
If the method is successful it responds with an JSON structure, as it is shown below.
{ "contact_id": 4836 }
Unsuccessful response sample:
{ "error": "Wrong API Key" }