and have difficulty understanding what is going wrong with my implementation. I am testing the call on a local server (Rails backend) and am getting the following response error (listkey and authtoken are removed from this example):
params: {
authtoken: AppConfig.zoho.api_key,
scope: "CampaignsAPI",
# listkey is for the "test test" mailing list
listkey: "-----"
}
)
def unsubscribe_user(user)
remove_subscription = ZOHO_CAMPAIGNS.post do |req|
req.url "listunsubscribe"
req.params["contactinfo"] = "<xml><fl val='First Name'>#{user.first_name}</fl><fl val='Last Name'>#{user.last_name}</fl><fl val='Contact Email'>#{user.email}</fl></xml>"
end.body
xml = Nokogiri::XML remove_subscription
xml.search("FL[val='Id']").text
end
Request:
#<struct Faraday::Request method=:post, path="listunsubscribe", params={"authtoken"=>"-------------------", "scope"=>"CampaignsAPI", "listkey"=>"------------------------", "contactinfo"=>"<xml><fl val='First Name'>best</fl><fl val='Last Name'>test</fl><fl val='Contact Email'>
best@test.com</fl></xml>"}, headers={"User-Agent"=>"Faraday v0.11.0"}, body=nil, options=#<Faraday::RequestOptions (empty)>>
Response:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<response uri="/api/xml/listunsubscribe" version="1">
<code>IAMError%3AZ101%3AISCSCOPE_MISMATCH</code>
<status>error</status>
<message/>
</response>