【问题标题】:Trying to save contacts with GetResponse api but I am unable to尝试使用 GetResponse api 保存联系人,但我无法
【发布时间】:2019-01-26 14:54:21
【问题描述】:

我的任务是在这个 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,但它没有发生。

获取响应文档

可以提供帮助的链接

Authentication

Saving contacts

你可以投反对票,但过去 3 天我一直在尝试,但没有发生。

【问题讨论】:

  • Eggzacklee 同样的经历。无法更新联系人。

标签: php api curl php-curl getresponse


【解决方案1】:

问题是您不需要向https://api.getresponse.com/v3/accounts 发送请求来验证您的呼叫。您收到的数据意味着您的身份验证标头可能是正确的,因此可以直接向https://api.getresponse.com/v3/contacts 发送 POST 请求。你的有效载荷看起来不错,所以你应该成功了。

【讨论】:

    猜你喜欢
    • 2016-12-20
    • 2018-05-17
    • 1970-01-01
    • 2019-06-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多