Issues with /Stats calls where entity is NOT ACCOUNT

auth
ads
api
campaign-management

#1

Hi,

I am developing a c# app to pull down data from the twitter ads api.

Every GET call works with the exception of the GET /1/stats/accounts/:account_id, with any entity that is not ACCOUNT.

For example:-

However if I try for a type that is NOT ACCOUNT and then include entity_ids with value of ids of the entity type I am looking for i.e. CAMPAIGN, I receive UNAUTHORISED ACCESS issues with a message of This request is not properly authenticated. I would have put this down to OAuth issues, however all other calls previous to this work.

Call:-
https://ads-api.twitter.com/1/stats/accounts/account_id?entity_ids=entity_id&entity=CAMPAIGN&end_time=2016-02-01T15%3A00%3A00Z&granularity=HOUR&metric_groups=ENGAGEMENT&placement=ALL_ON_TWITTER&start_time=2016-02-01T17%3A00%3A00Z

Error:-
"{“errors”:[{“code”:“UNAUTHORIZED_ACCESS”,“message”:“This request is not properly authenticated”}],“request”:{“params”:{}}}"

Thanks in advance.


#2

I would recommend to capture the raw HTTP request from using twurl using ‘-t’ parameter (trace?) and compare with the raw HTTP request (you might have to use Fiddler or something to listen on network calls if your code doesn’t log it), the URL formatted call you wrote looks fine to me as long as accounts/account_id actually being replaced by the real account_id properly etc.

You should also check if you can do the same call with twurl - if you can’t there could be a problem with the app’s permissions.

Finally there is a c# SDK that some folks were working on - it would be great to have collaborators sort of rally around a solution: Twitter Ads API Integration With C# Application

Thanks,

John