Facing issue while fetching scheduled promoted tweet


#1

Hey Team,

While fetching Scheduled promoted tweets for a particular ad account we are quite often running into request limits.

These rate limit thresholds seem to be different from other end points (for ex promoted tweets GET)

Response

{code}[HttpResponse{statusCode=429, responseAsString=’{“errors”:[{“code”:“TOO_MANY_REQUESTS”,“message”:“Too many requests”}],“request”:{“params”:{}}}{code}

accountId + “/scheduled_promoted_tweets/”; end point

We are not passing any other params but the account id

Please let me know in case you need detailed info, will set log levels to debug and get information

Thanks


#2

Thanks, @abhishek_pyro. Could you make a twurl request using the -t flag? The GET accounts/:account_id/scheduled_promoted_tweets endpoint shares the same rate limit profile as all regular reads: 2,000 requests per 15 minutes. See x-rate-limit-limit.

-> "HTTP/1.1 200 OK\r\n"
-> "connection: close\r\n"
-> "content-disposition: attachment; filename=json.json\r\n"
-> "content-encoding: gzip\r\n"
-> "content-length: 463\r\n"
-> "content-type: application/json;charset=utf-8\r\n"
-> "date: Wed, 25 Oct 2017 04:32:55 GMT\r\n"
-> "server: tsa_a\r\n"
-> "set-cookie: personalization_id=\"v1_0555PNBF8PPp6+WRwfIZKg==\"; Expires=Fri, 25 Oct 2019 04:32:55 UTC; Path=/; Domain=.twitter.com\r\n"
-> "set-cookie: guest_id=v1%3A150890597517440145; Expires=Fri, 25 Oct 2019 04:32:55 UTC; Path=/; Domain=.twitter.com\r\n"
-> "strict-transport-security: max-age=631138519\r\n"
-> "x-access-level: read-write\r\n"
-> "x-api-version: 2.0\r\n"
-> "x-connection-hash: f63414834fee9a2b8286352bccfc9c89\r\n"
-> "x-content-type-options: nosniff\r\n"
-> "x-current-api-version: 2.0\r\n"
-> "x-frame-options: SAMEORIGIN\r\n"
-> "x-rate-limit-limit: 2000\r\n"
-> "x-rate-limit-remaining: 1999\r\n"
-> "x-rate-limit-reset: 1508906871\r\n"
-> "x-response-time: 31\r\n"
-> "x-runtime: 0.020006\r\n"
-> "x-transaction: 00d93432007f0bf5\r\n"
-> "x-xss-protection: 1; mode=block\r\n"
-> "\r\n"

#3

Hey @juanshishido

twurl -XGET -H ‘ads-api.twitter.com’ ‘/2/accounts/18ce545ggqf/scheduled_promoted_tweets’ -t

<- "" -> "HTTP/1.1 200 OK\r\n" -> "connection: close\r\n" -> "content-disposition: attachment; filename=json.json\r\n" -> "content-encoding: gzip\r\n" -> "content-length: 285\r\n" -> "content-type: application/json;charset=utf-8\r\n" -> "date: Wed, 25 Oct 2017 11:53:11 GMT\r\n" -> "server: tsa_k\r\n" -> "set-cookie: personalization_id=\"v1_GYnJ8nKcQ+jzHsBiilbccg==\"; Expires=Fri, 25 Oct 2019 11:53:11 UTC; Path=/; Domain=.twitter.com\r\n" -> "set-cookie: guest_id=v1%3A150893239132822914; Expires=Fri, 25 Oct 2019 11:53:11 UTC; Path=/; Domain=.twitter.com\r\n" -> "strict-transport-security: max-age=631138519\r\n" -> "x-access-level: read-write-directmessages\r\n" -> "x-api-version: 2.0\r\n" -> "x-connection-hash: 4c4c4f3ae1cf998e9d2eb85fc2bafda7\r\n" -> "x-content-type-options: nosniff\r\n" -> "x-current-api-version: 2.0\r\n" -> "x-frame-options: SAMEORIGIN\r\n" -> "x-rate-limit-limit: 2000\r\n" -> "x-rate-limit-remaining: 1559\r\n" -> "x-rate-limit-reset: 1508932888\r\n" -> "x-response-time: 190\r\n" -> "x-runtime: 0.014676\r\n" -> "x-transaction: 00b3380a00393e6a\r\n" -> "x-xss-protection: 1; mode=block\r\n" -> "\r\n"

twurl -XGET -H ‘ads-api.twitter.com’ ‘/2/accounts/18ce545ggqf/scheduled_tweets’ -t

<- "" -> "HTTP/1.1 200 OK\r\n" -> "connection: close\r\n" -> "content-disposition: attachment; filename=json.json\r\n" -> "content-encoding: gzip\r\n" -> "content-length: 79\r\n" -> "content-type: application/json;charset=utf-8\r\n" -> "date: Wed, 25 Oct 2017 11:54:17 GMT\r\n" -> "server: tsa_k\r\n" -> "set-cookie: personalization_id=\"v1_Mh11SopMTsYiSXNIacw6mg==\"; Expires=Fri, 25 Oct 2019 11:54:17 UTC; Path=/; Domain=.twitter.com\r\n" -> "set-cookie: guest_id=v1%3A150893245712174995; Expires=Fri, 25 Oct 2019 11:54:17 UTC; Path=/; Domain=.twitter.com\r\n" -> "strict-transport-security: max-age=631138519\r\n" -> "x-access-level: read-write-directmessages\r\n" -> "x-api-version: 2.0\r\n" -> "x-connection-hash: 069f36e77547e1035761afd1a9b111a4\r\n" -> "x-content-type-options: nosniff\r\n" -> "x-current-api-version: 2.0\r\n" -> "x-frame-options: SAMEORIGIN\r\n" -> "x-rate-limit-limit: 2000\r\n" -> "x-rate-limit-remaining: 1519\r\n" -> "x-rate-limit-reset: 1508932888\r\n" -> "x-response-time: 199\r\n" -> "x-runtime: 0.02468\r\n" -> "x-transaction: 004fa4c500636500\r\n" -> "x-xss-protection: 1; mode=block\r\n" -> "\r\n"


#4

Looks like "x-rate-limit-limit: 2000 in both cases. Could you elaborate on what the issue is?


#5

Hey @juanshishido

So we were fetching the scheduled_tweets every one minute (compliance), and the scheduled_promoted_tweet every 5 minutes via the API.

We changed the frequency of the former to one hour due to rate limits affecting the latter call.

Due to some limitations at our end we cannot reduce the frequency of scheduled_promoted_tweets fetch call (a different promoted_tweet object is created for every scheduled_promoted_tweet with a different so we resolve the two at our end.)

Even after doing the above we are facing “Too many requests” error for scheduled_promoted_tweet end point for a few accounts. This does not seem to be the App level limit but rather the endpoint limit or user limit.

Just wanted more info if this end point behaves differently than the promoted_tweets fetch end point OR if we can get the threshold increased somehow.

We could not reproduce this via twurl but Http calls seem to be facing this issue intermittently (not sure if the backend services at your end are different for the two).


#6

@abhishek_pyro: We’ve looked into this a bit more and believe we understand the issue you’re describing.

In general, rate limits are scoped by either category or endpoint (documentation). Every resource that includes an :account_id in its path gets 2,000 requests per 15 minutes, for example, which means campaigns and line items each get 2,000 reads.

However, for both Scheduled Tweets and Scheduled Promoted Tweets, it looks like the rate limit is global rather than endpoint-specific. Let us see what we can do in terms of updating the rate limit profiles for these resources.

Thanks for bringing this to our attention!


#7

Hi Juanshishido,

Any update here?

Regards
Navinkumar


#8

Thanks for following up, @tulipgoldhotel. This should be fixed soon. We’ll update the thread with more information as we have it.


#9

@abhishek_pyro and @tulipgoldhotel: Thanks again for bringing this to our attention. This issue has now been resolved.

Scheduled Promoted Tweets:

$ twurl -t -H ads-api.twitter.com "/2/accounts/18ce54d4x5t/scheduled_promoted_tweets?count=1"
opening connection to ads-api.twitter.com:443...
opened
starting SSL for ads-api.twitter.com:443...
SSL established
...
-> "HTTP/1.1 200 OK\r\n"
-> "connection: close\r\n"
-> "content-disposition: attachment; filename=json.json\r\n"
-> "content-encoding: gzip\r\n"
-> "content-length: 224\r\n"
-> "content-type: application/json;charset=utf-8\r\n"
-> "date: Mon, 27 Nov 2017 23:33:04 GMT\r\n"
-> "server: tsa_a\r\n"
-> "set-cookie: personalization_id=\"v1_Ljm5qouQTBIgLw8n/MaROw==\"; Expires=Wed, 27 Nov 2019 23:33:04 UTC; Path=/; Domain=.twitter.com\r\n"
-> "set-cookie: guest_id=v1%3A151182558415792757; Expires=Wed, 27 Nov 2019 23:33:04 UTC; Path=/; Domain=.twitter.com\r\n"
-> "strict-transport-security: max-age=631138519\r\n"
-> "x-access-level: read-write\r\n"
-> "x-api-version: 2.0\r\n"
-> "x-connection-hash: 0e40204d68a0c37ab71bc63a06bd98a5\r\n"
-> "x-content-type-options: nosniff\r\n"
-> "x-current-api-version: 2.0\r\n"
-> "x-frame-options: SAMEORIGIN\r\n"
-> "x-rate-limit-limit: 2000\r\n"
-> "x-rate-limit-remaining: 1999\r\n"
-> "x-rate-limit-reset: 1511826484\r\n"
-> "x-response-time: 36\r\n"
-> "x-runtime: 0.02662\r\n"
-> "x-transaction: 009c75db00bcf677\r\n"
-> "x-xss-protection: 1; mode=block\r\n"
-> "\r\n"
reading 224 bytes...
...

Scheduled Tweets:

$ twurl -t -H ads-api.twitter.com "/2/accounts/18ce54d4x5t/scheduled_tweets?count=1"
opening connection to ads-api.twitter.com:443...
opened
starting SSL for ads-api.twitter.com:443...
SSL established
...
-> "HTTP/1.1 200 OK\r\n"
-> "connection: close\r\n"
-> "content-disposition: attachment; filename=json.json\r\n"
-> "content-encoding: gzip\r\n"
-> "content-length: 303\r\n"
-> "content-type: application/json;charset=utf-8\r\n"
-> "date: Mon, 27 Nov 2017 23:33:18 GMT\r\n"
-> "server: tsa_a\r\n"
-> "set-cookie: personalization_id=\"v1_BTnccScV8T8YMX8Uz4Qt7w==\"; Expires=Wed, 27 Nov 2019 23:33:18 UTC; Path=/; Domain=.twitter.com\r\n"
-> "set-cookie: guest_id=v1%3A151182559819695253; Expires=Wed, 27 Nov 2019 23:33:18 UTC; Path=/; Domain=.twitter.com\r\n"
-> "strict-transport-security: max-age=631138519\r\n"
-> "x-access-level: read-write\r\n"
-> "x-api-version: 2.0\r\n"
-> "x-connection-hash: 9f7ec02fd38fc7df9094244c326035b6\r\n"
-> "x-content-type-options: nosniff\r\n"
-> "x-current-api-version: 2.0\r\n"
-> "x-frame-options: SAMEORIGIN\r\n"
-> "x-rate-limit-limit: 2000\r\n"
-> "x-rate-limit-remaining: 1999\r\n"
-> "x-rate-limit-reset: 1511826498\r\n"
-> "x-response-time: 52\r\n"
-> "x-runtime: 0.04114\r\n"
-> "x-transaction: 0091800800d99992\r\n"
-> "x-xss-protection: 1; mode=block\r\n"
-> "\r\n"
...

Accounts

$ twurl -t -H ads-api.twitter.com "/2/accounts?count=1"
opening connection to ads-api.twitter.com:443...
opened
starting SSL for ads-api.twitter.com:443...
SSL established
...
-> "HTTP/1.1 200 OK\r\n"
-> "connection: close\r\n"
-> "content-disposition: attachment; filename=json.json\r\n"
-> "content-encoding: gzip\r\n"
-> "content-length: 304\r\n"
-> "content-type: application/json;charset=utf-8\r\n"
-> "date: Mon, 27 Nov 2017 23:39:05 GMT\r\n"
-> "server: tsa_a\r\n"
-> "set-cookie: personalization_id=\"v1_mUmFpx46ZXBjjP95RC+dNQ==\"; Expires=Wed, 27 Nov 2019 23:39:05 UTC; Path=/; Domain=.twitter.com\r\n"
-> "set-cookie: guest_id=v1%3A151182594570629457; Expires=Wed, 27 Nov 2019 23:39:05 UTC; Path=/; Domain=.twitter.com\r\n"
-> "strict-transport-security: max-age=631138519\r\n"
-> "x-access-level: read-write\r\n"
-> "x-api-version: 2.0\r\n"
-> "x-connection-hash: 841f0ac82a765c45f15fcb2a52efed4d\r\n"
-> "x-content-type-options: nosniff\r\n"
-> "x-current-api-version: 2.0\r\n"
-> "x-frame-options: SAMEORIGIN\r\n"
-> "x-rate-limit-limit: 2000\r\n"
-> "x-rate-limit-remaining: 1999\r\n"
-> "x-rate-limit-reset: 1511826511\r\n"
-> "x-response-time: 23\r\n"
-> "x-runtime: 0.011352\r\n"
-> "x-transaction: 0012b82a00fca625\r\n"
-> "x-xss-protection: 1; mode=block\r\n"
-> "\r\n"
...