LMD_NZ
#1
Hi. Apologies, I’m a noob here.
My client has asked me to retrieve Ad spend by date and ad/campaign for as much of the account’s history as is available.
I’ve generated the bearer token via the ads dashboard but using this gives me a 401 in my ETL tool.
I’ve also tried generating Oauth2 tokens. I have no issue generating the token but these also give me a 401 when I try to use them.
I’ve tested a few endpoints and some give me an application error. Below are a few of my attempts, along with the results. If anyone can point me in the right direction, I’d be very appreciative!
P.s. I’m pretty sure that it’s the asynchronus analytics data that I need but can’t be 100% sure until I’ve seen it.
Many thanks in advance!
Hello,
Thanks for reaching out. I was wondering what is the method you used to authenticate? Can you try using the twurl command and pass in your credentials to see if it works?
LMD_NZ
#3
Hi, Jared,
I tried firstly, using the Bearer token that I generated when I set up the account. The one you get from this page https://developer.twitter.com/en/portal/projects/1579947044596158465/apps/25708185/settings
I refer to that in my support request in the below highlighted cells

When that didn’t work, I tried generating an Oauth 2.0 in my ETL process. Call and response details below

And I reference that in the other two columns of my support request.
As you can see, I get exactly the same response from each of those. Either an authentication issue or an application error, depending on the end point that I try to call.
Can you see anything obviously wrong in how I’m structuring the calls?
Many thanks
Hello,
The Ads API endpoint do not support OAuth2.0 for now. As such, the only option is OAuth1.0 which I would advice to use the twurl command to test it out
LMD_NZ
#5
Ok thanks. So I should follow these instructions to get my Oauth 1.0a token?
Do you have an example where the variables are populated? Or, are you able to tell me which “tools or libraries” the doc refers to for this use case?
Many thanks
Hello,
You can actually install twurl command on your terminal. Once you have done it, you can run the command
twurl authorize --consumer-key key --consumer-secret secret
Where consumer key and consumer secret can be found in the settings page of the developer portal dashboard
For now, try to use twurl to authorize and check if your tokens are actually functioning. Once this is verified, you can use tools like Postman or other methods such as Python/Ruby as listed here