cancel
Showing results for 
Search instead for 
Did you mean: 

API - subscribing back an e-mail address

SOLVED
Occasional Advisor

API - subscribing back an e-mail address

Hi, I'm confused about options for changing contact status from OPTOUT to ACTIVE via API. I do understand that it must be triggered by the user himself.

 

Your documentation on Opting contacts back in seems to say that if I set action_by to ACTION_BY_VISITOR then I should be able to do that with the PUT method. However, when I look at documentation for Individual Contacts / PUT the description for both contact status and e-mail address status says "(Read Only)".

 

Also, when I use your Mashery API Tester/debugger (indispensable, by the way), I get an error when I try anyway. I did use ACTION_BY_VISITOR.

 

Request:

{
    "id": "1416757038",
    "status": "ACTIVE",
    "lists": [],
    "email_addresses": [
    {
        "status": "ACTIVE",
        "email_address": "whatever@email.com"
    }
    ],
    "first_name": "Jane",
    "last_name": "Doe"
}

 

Response Status:
  400 Bad Request

Response Headers:
  Cache-Control: private, no-cache, no-store, max-age=0, must-revalidate, no-cache="Set-Cookie"
  Content-Type: application/json
  Date: Wed, 10 Sep 2014 22:07:10 GMT
  Pragma: no-cache
  Server: Apache
  Vary: Accept-Encoding,User-Agent
  X-Mashery-Responder: prod-j-worker-us-east-1e-49.mashery.com
  X-Powered-By:
  Content-Length: 136
  Connection: keep-alive


Response Body
  [{
      "error_key": "query.param.action_by.is_not_valid_for.delete",
      "error_message": "The action_by value is not valid for contact deletion."
  }]

 

I don't understand what the error message means, or where I could find its meaning. Any idea?

 

Thanks

Petr

1 REPLY 1
Occasional Advisor

Re: API - subscribing back an e-mail address

The issue has been resolved thanks to Shannon from Webservices@constantcontact.com.

 

My error was that I didn't add the contact to any list - i.e. the lists value was an empty array.

 

I missed that the chapter Opting contacts back in mentions that "...they must be added to a contact list when adding them to the contact collection."