Issues with Pre-roll CTA Endpoint - INTERNAL_ERROR

ads
error-codes
api

#1

Dear Twitter Staff,

In regards to the Pre-roll CTA Endpoint, it looks like it has now been updated to show the correct endpoint: POST accounts/:account_id/preroll_call_to_actions

But when we tried to hit this endpoint, we received an INTERNAL_ERROR error code. Please see the following TWURL and advise:

twurl -t -H "https://ads-api-sandbox.twitter.com/" "/0/accounts/gq0w3i/preroll_call_to_actions" -d "line_item_id=cmab" -d "call_to_action=VISIT_SITE" -d "call_to_action_url=http://twitter.com/" -t | json-prettify

Here is the response:

{
  "errors": [
    {
      "code": "INTERNAL_ERROR",
      "message": "Internal Error"
    }
  ],
  "request": {
    "params": {
    }
  }
}

And here is the full trace:

    8963 % twurl -t -H "https://ads-api-sandbox.twitter.com/" "/0/accounts/gq0w3i/preroll_call_to_actions" -d "line_item_id=cmab" -d "call_to_action=VISIT_SITE" -d "call_to_action_url=http%3A%2F%2Ftwitter.com%2F" -t | json-prettify opening connection to ads-api-sandbox.twitter.com...
opened
<- "POST /0/accounts/gq0w3i/preroll_call_to_actions HTTP/1.1\r\nAccept: */*\r\nUser-Agent: OAuth gem v0.4.7\r\nContent-Type: application/x-www-form-urlencoded\r\nAuthorization: OAuth oauth_consumer_key=\"EC2gKPePluhEBh49u26nA\", oauth_nonce=\"6JhjYneO2krAzj8IzcKpJGK9U0GudQBLgCQqfv6Ydg\", oauth_signature=\"DzRV5o2trLKiA4%2BYimw6nSVTDP0%3D\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"1458779439\", oauth_token=\"3073813016-2Gxuh05I9karD6Vpj60XQVsPeZ85oXQ8pDhJsYL\", oauth_version=\"1.0\"\r\nConnection: close\r\nHost: ads-api-sandbox.twitter.com\r\nContent-Length: 98\r\n\r\n"
<- "line_item_id=cmab&call_to_action=VISIT_SITE&call_to_action_url=http%253A%252F%252Ftwitter.com%252F"
-> "HTTP/1.1 500 Internal Server Error\r\n"
-> "connection: close\r\n"
-> "content-disposition: attachment; filename=json.json\r\n"
-> "content-length: 89\r\n"
-> "content-type: application/json;charset=utf-8\r\n"
-> "date: Thu, 24 Mar 2016 00:30:40 GMT\r\n"
-> "server: tsa_a\r\n"
-> "set-cookie: guest_id=v1%3A145877944000610344; Domain=.twitter.com; Path=/; Expires=Sat, 24-Mar-2018 00:30:40 UTC\r\n"
-> "strict-transport-security: max-age=631138519\r\n"
-> "x-access-level: read-write-directmessages\r\n"
-> "x-connection-hash: 25d049f049d2c9f02691330011ae30fd\r\n"
-> "x-content-type-options: nosniff\r\n"
-> "x-frame-options: SAMEORIGIN\r\n"
-> "x-rate-limit-limit: 300\r\n"
-> "x-rate-limit-remaining: 300\r\n"
-> "x-rate-limit-reset: 1458779500\r\n"
-> "x-response-time: 64\r\n"
-> "x-runtime: 0.051207\r\n"
-> "x-transaction: 616ece2f5e86f4fd\r\n"
-> "x-tsa-request-body-time: 88\r\n"
-> "x-xss-protection: 1; mode=block\r\n"
-> "\r\n"
reading 89 bytes...
-> ""
-> "{\"errors\":[{\"code\":\"INTERNAL_ERROR\",\"message\":\"Internal Error\"}],\"request\":{\"params\":{}}}"
read 89 bytes
Conn close
{
  "errors": [
    {
      "code": "INTERNAL_ERROR",
      "message": "Internal Error"
    }
  ],
  "request": {
    "params": {
    }
  }
}

POST /preroll_call_to_action ROUTE_NOT_FOUND
#2

Just as a follow up, the endpoint seems to recognize and raise validation when we don’t provide certain attributes such as call_to_action. See the following twurl please:

% twurl -t -H "https://ads-api-sandbox.twitter.com/" "/1/accounts/gq0w3i/preroll_call_to_actions" -d "line_item_id=cmax"  -t | json-prettify                                                         2016-03-24 14:33:52 scott ‹1.9.3-p551›
opening connection to ads-api-sandbox.twitter.com...
opened
<- "POST /1/accounts/gq0w3i/preroll_call_to_actions HTTP/1.1\r\nAccept: */*\r\nUser-Agent: OAuth gem v0.4.7\r\nContent-Type: application/x-www-form-urlencoded\r\nAuthorization: OAuth oauth_consumer_key=\"EC2gKPePluhEBh49u26nA\", oauth_nonce=\"e5mkKG2vMQdyarYU5QG9hfaaWkg14LtKIFKG0Cs5y8\", oauth_signature=\"DEnC8vV6cnikZJukZYm826bd1Xg%3D\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"1458855244\", oauth_token=\"3073813016-2Gxuh05I9karD6Vpj60XQVsPeZ85oXQ8pDhJsYL\", oauth_version=\"1.0\"\r\nConnection: close\r\nHost: ads-api-sandbox.twitter.com\r\nContent-Length: 17\r\n\r\n"
<- "line_item_id=cmax"
-> "HTTP/1.1 400 Bad Request\r\n"
-> "connection: close\r\n"
-> "content-disposition: attachment; filename=json.json\r\n"
-> "content-length: 313\r\n"
-> "content-type: application/json;charset=utf-8\r\n"
-> "date: Thu, 24 Mar 2016 21:34:05 GMT\r\n"
-> "server: tsa_b\r\n"
-> "set-cookie: guest_id=v1%3A145885524524895350; Domain=.twitter.com; Path=/; Expires=Sat, 24-Mar-2018 21:34:05 UTC\r\n"
-> "strict-transport-security: max-age=631138519\r\n"
-> "x-access-level: read-write-directmessages\r\n"
-> "x-api-version: 0.0\r\n"
-> "x-connection-hash: e2d327d2de67c31f4abde7ea3b9bd94d\r\n"
-> "x-content-type-options: nosniff\r\n"
-> "x-frame-options: SAMEORIGIN\r\n"
-> "x-rate-limit-limit: 300\r\n"
-> "x-rate-limit-remaining: 300\r\n"
-> "x-rate-limit-reset: 1458855257\r\n"
-> "x-response-time: 101\r\n"
-> "x-runtime: 0.026911\r\n"
-> "x-transaction: e9f4c3839dfeb442\r\n"
-> "x-tsa-request-body-time: 103\r\n"
-> "x-xss-protection: 1; mode=block\r\n"
-> "\r\n"
reading 313 bytes...
-> ""
-> "{\"errors\":[{\"code\":\"MISSING_PARAMETER\",\"message\":\"\\\"call_to_action\\\" is a required parameter\",\"parameter\":\"call_to_action\"},{\"code\":\"MISSING_PARAMETER\",\"message\":\"\\\"call_to_action_url\\\" is a required parameter\",\"parameter\":\"call_to_action_url\"}],\"request\":{\"params\":{\"line_item_id\":\"cmax\",\"account_id\":\"gq0w3i\"}}}"
read 313 bytes
Conn close
{
  "errors": [
    {
      "code": "MISSING_PARAMETER",
      "message": "\"call_to_action\" is a required parameter",
      "parameter": "call_to_action"
    },
    {
      "code": "MISSING_PARAMETER",
      "message": "\"call_to_action_url\" is a required parameter",
      "parameter": "call_to_action_url"
    }
  ],
  "request": {
    "params": {
      "line_item_id": "cmax",
      "account_id": "gq0w3i"
    }
  }
}

But when provide the expected details, it still sends back an INTERNAL_ERROR code.


#3

Hi -

Can you check to see if you are encoding the parameters? I believe http:// is the part that may be causing a problem (it should be passed as %3A%2F%2F)

Thanks,

John


#4

@JBabichJapan

Thank you very much for responding. We have tried again as you recommended, but there is no change in the response from the API. Here is the full trace:

twurl -t -H "https://ads-api-sandbox.twitter.com/" "/0/accounts/gq0w3i/preroll_call_to_actions" -d "line_item_id=cmab" -d "call_to_action=VISIT_SITE" -d "call_to_action_url=http%3A%2F%2Ftwitter.com%2F" -t | json-prettify
opening connection to ads-api-sandbox.twitter.com...
opened
<- "POST /0/accounts/gq0w3i/preroll_call_to_actions HTTP/1.1\r\nAccept: */*\r\nUser-Agent: OAuth gem v0.4.7\r\nContent-Type: application/x-www-form-urlencoded\r\nAuthorization: OAuth oauth_consumer_key=\"EC2gKPePluhEBh49u26nA\", oauth_nonce=\"QAcQAtGEvNblxUSTjYJxS0MnLgHTcHc6cLxD4uymd2U\", oauth_signature=\"N7yjIDUKDY%2BD4HnTCl8dVUbKkrk%3D\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"1459189654\", oauth_token=\"3073813016-2Gxuh05I9karD6Vpj60XQVsPeZ85oXQ8pDhJsYL\", oauth_version=\"1.0\"\r\nConnection: close\r\nHost: ads-api-sandbox.twitter.com\r\nContent-Length: 98\r\n\r\n"
<- "line_item_id=cmab&call_to_action=VISIT_SITE&call_to_action_url=http%253A%252F%252Ftwitter.com%252F"
-> "HTTP/1.1 500 Internal Server Error\r\n"
-> "connection: close\r\n"
-> "content-disposition: attachment; filename=json.json\r\n"
-> "content-length: 89\r\n"
-> "content-type: application/json;charset=utf-8\r\n"
-> "date: Mon, 28 Mar 2016 18:27:35 GMT\r\n"
-> "server: tsa_a\r\n"
-> "set-cookie: guest_id=v1%3A145918965564005503; Domain=.twitter.com; Path=/; Expires=Wed, 28-Mar-2018 18:27:35 UTC\r\n"
-> "strict-transport-security: max-age=631138519\r\n"
-> "x-access-level: read-write-directmessages\r\n"
-> "x-connection-hash: 4db8f26e75303e5a175af7c2fe730d1a\r\n"
-> "x-content-type-options: nosniff\r\n"
-> "x-frame-options: SAMEORIGIN\r\n"
-> "x-rate-limit-limit: 300\r\n"
-> "x-rate-limit-remaining: 300\r\n"
-> "x-rate-limit-reset: 1459189715\r\n"
-> "x-response-time: 103\r\n"
-> "x-runtime: 0.082909\r\n"
-> "x-transaction: c948f4e9d9092eea\r\n"
-> "x-tsa-request-body-time: 119\r\n"
-> "x-xss-protection: 1; mode=block\r\n"
-> "\r\n"
reading 89 bytes...
-> ""
-> "{\"errors\":[{\"code\":\"INTERNAL_ERROR\",\"message\":\"Internal Error\"}],\"request\":{\"params\":{}}}"
read 89 bytes
Conn close
{
  "errors": [
{
  "code": "INTERNAL_ERROR",
  "message": "Internal Error"
}
  ],
  "request": {
"params": {
}
  }
}

Please advise.


#5

@jaakkosf any suggestions sir?


#6

I just compared your call to the one from our documentation and I don’t see any other issues so in the meantime - there are two other possibilities for INTERNAL_ERROR which I’ve seen before:

  1. Sandbox doesn’t have the functionality for this endpoint or has it but it’s not working properly -> sometimes this is difficult for us to debug so it would be nice to know if it repros for you on non-Sandbox environment.

  2. You don’t have permission to call the endpoint and the error is not being raised properly.

There is a slight possibility that even after setting features with POST features on sandbox that it still is error-ing out for lack of some other data. The best test of your implementation is if you hit the production endpoint upon an account that has the feature key as described here:

https://dev.twitter.com/ads/campaigns/video-views-preroll-objective

First, you’ll want to confirm that the ads account has been whitelisted for the VIDEO_VIEWS_PREROLL_OBJECTIVE feature. You can check this using the GET accounts/:account_id/features endpoint.

Hope something here can help you!