Cannot access the /stats/ part of the API


#1

I’m having trouble accessing this Ads API endpoint:
https://ads-api.twitter.com/0/stats/accounts//promoted_tweets//?start_time=2014-11-11T00:00:00Z

The error response is:
“The client application making this request does not have access to this API”

I can access other endpoints like this one:
https://ads-api.twitter.com/0/accounts//promoted_tweets/

Could this be an issue with our application permissions for the /stats/ part of the API specifically?

Thanks!


Cannot access the /stats/ part of the API (Topic #2)
Stats endpoint errors (diagnosed?)
#2

Hi @jonathansewell - is it just this one or are you not able to access any /stats/ endpoints?


#3

Hi @jillblaz, I’ve tried a few more endpoints and get the same problem:

stats/accounts/:account_id
stats/accounts/:account_id/campaigns
stats/accounts/:account_id/campaigns/:id
stats/accounts/:account_id/promoted_tweets

I can access the non-stats endpoints, for example:
accounts/:account_id/campaigns/:campaign_id

Thanks,
Jonathan

By the way I’m in the UK so our time zones are probably completely out of sync… I’ll probably be out of the office when you get in! :earth_americas: :earth_africa: :earth_asia: :smile:


#4

Hi @jonathansewell - no problem, I’m sure you can set some sort of alert on your phone to wake you up when I respond :wink:

I was able to successfully run this request from your account:

$ twurl -X GET -H ads-api.twitter.com "/0/stats/accounts/xxxxx/campaigns/xxx?start_time=2014-11-05T00:00:00Z&granularity=TOTAL" 

Try to run that with your account and campaign info and let me know what you see. Are you running this from your @jonathansewell handle?


#5

Hi @jillblaz, yes I can run the request using twurl and that works fine :confused: I still get the error when I run it using my implementation.

For my implementation I’m using oauth with an application key/secret (belonging to a Brandwatch app). My account @jonathansewell owns the ads account and campaign. So I’m authorising the Brandwatch app to use my data via oauth.

Some of the ads API calls work with this implementation, but some give me that error about the application not being authorised.

I’m using node.js and the https://github.com/ciaranj/node-oauth library like this:

    var oa = new OAuth(
            "https://api.twitter.com/oauth/request_token",
            "https://api.twitter.com/oauth/access_token",
            appSettings.twitterAppId,
            appSettings.twitterAppConsumerSecret,
            "1.0",
            null,
            "HMAC-SHA1"
        );

Is there something specific about the oauth for the /stats/ api calls that I’ve missed?

Thanks again!

Jonathan


#6

Hi @jonathansewell,

The fact that this works for you and Jill in twurl rules out an actual permission issues with your application. There is a bug right now in the API where some 401 (Not Authorized) errors are being returned incorrectly as 403 (Forbidden) errors and they look like app permissions issues.

It’s likely that the problem here is either an invalid access token or an issue in your application’s oauth implementation (eg. incorrect signature, malformed request, encoding issues, etc).

A few things:

  1. Can you post the full and raw HTTP request and response for one of the API calls that’s failing for you?
  2. Do the calls that succeed use the same access token as the calls that fail?

#7

This topic was automatically closed after 12 hours. New replies are no longer allowed.