我的任务是在此api上进行身份验证 https://api.getresponse.com/v3/accounts
然后需要保存以下API https://api.getresponse.com/v3/POST/contacts
数据必须采用以下格式
{
"name": "Hemant Maurya",
"email": "xyz@yahoo.com",
"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": "xyz.com@gmail.com",
"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天了,而且没有发生。
答案 0 :(得分:0)
问题是,您无需向https://api.getresponse.com/v3/accounts
发送请求即可对您的呼叫进行身份验证。收到的数据表示您的身份验证标头可能正确,因此可以直接继续向https://api.getresponse.com/v3/contacts
发送POST请求。您的有效负载看起来不错,所以您应该成功完成它。