我的任务是在这个API认证https://api.getresponse.com/v3/accounts
然后需要保存下列API https://api.getresponse.com/v3/POST/contacts
数据必须是以下格式
{
"name": "Hemant Maurya",
"email": "[email protected]",
"dayOfCycle": "0",
"campaign": {
"campaignId": "6mzZL"
},
"tags": [
{
"tagId": "Xw"
},
{
"tagId": "Nn"
}
],
"scoring": 25,
"customFieldValues": [
{
"customFieldId": "n",
"value": [
"white"
]
}
],
"ipAddress": "14.143.38.111"
}
下面的代码可以进行身份验证
$url = "https://api.getresponse.com/v3/accounts";
$headers = array();
$headers[] = "X-Auth-Token: api-key 17fbe43cc8a23daaf36b35093c77djet";//api key is fake at the moment
$state_ch = curl_init();
curl_setopt($state_ch, CURLOPT_URL, $url);
curl_setopt($state_ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($state_ch, CURLOPT_HTTPHEADER, $headers);
$state_result = curl_exec ($state_ch);
$state_result = json_decode($state_result);
$debug = 1;
print_r($state_result);
响应是如以下
{
"accountId": "fjnfd",
"firstName": "first name",
"lastName": "last name",
"email": "[email protected]",
"phone": "+3798798",
"companyName": "",
"state": "state address",
"city": "city address",
"street": "street address",
"zipCode": "226010",
"countryCode": {
"countryCodeId": "100",
"countryCode": "IN"
},
"industryTag": {
"industryTagId": null
},
"numberOfEmployees": null,
"timeFormat": "12h",
"timeZone": {
"name": "Asia/Kolkata",
"offset": "+09:30"
},
"href": "https://api.getresponse.com/v3/accounts"
}
我没有得到如何保存从GitHub试图GetResponseAPI3.class.php的数据,但它没有发生。
得到响应文件
可以帮助链接
你可以将其否决,但我一直在努力为过去3天,它不会发生。
问题是,你并不需要发送给https://api.getresponse.com/v3/accounts
验证您的通话请求。您收到的数据意味着你的认证头可能是正确的,所以可以直接到发送POST请求https://api.getresponse.com/v3/contacts
。你的有效载荷看起来很好,所以你应该让成功。