2

My task is to authenticate on this api https://api.getresponse.com/v3/accounts

Then need to save on the following api https://api.getresponse.com/v3/POST/contacts

data must be in the following format

{
"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"
}

Following code can authenticate

$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);

The response is as following

{
"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"
}

I am not getting how to save the data tried GetResponseAPI3.class.php from Github but it's not happening.

get response documentation

Links that can Help

Authentication

Saving contacts

You may vote it down but I have been trying for last 3 days and it's not happening.

1 Answers1

0

The thing is that you don't need to send a request to https://api.getresponse.com/v3/accounts to authenticate your calls. The data that you receive means your authentication headers are probably correct, so can directly proceed to sending POST requests to https://api.getresponse.com/v3/contacts. Your payload looks fine so you should make it successfully.

a-change
  • 656
  • 5
  • 12