I am using the ExactTarget REST API.
I am able to get my access token successfully via OAuth and can make some GET requests (i.e. https://www.exacttargetapis.com/contacts/v1/schema) that return the expected results, but I get no response when I attempt to create a new contact.
(I have confirmed the app has write access).
What am I doing wrong? Thanks.
<?php
$url = 'https://www.exacttargetapis.com/contacts/v1/contacts';
$json = '{
"contactKey": "[email protected]",
"attributeSets": [{
"name": "Email Addresses",
"items": [{
"values": [{
"name": "Email Address",
"value": "[email protected]"
}]
}]
}]
}';
$options = array(
'http' => array(
'header' => "Content-Type: application/json\r\n" .
"Accept: application/json\r\n" .
"Authorization: Bearer " . $access_token . "\r\n",
'method' => 'POST',
'content' => http_build_query($json)
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
if ($result === FALSE) { echo "Result not returned"; }
print_r($result);
?>