How to test proper account setup and endpoint access?


#1

Hi. I posted specifically about starting my 30-Day Search API dev with twurl, but I’m not sure that is supported. It is not working.

Is there an easy and reliable way to test if my Twitter account (handle) has access to the 30-Day Search API?


#2

Hi there,

One way would be to make a request using cURL. Assuming you’ve already generated a Bearer Token, the call would look like:

curl -X POST “https://api.twitter.com/1.1/tweets/search/30day/Sandbox.json” -d ‘{“query”:“snow”,“maxResults”:“100”,“fromDate”:“201801080000”,“toDate”:“201801090000”}’ -H “Authorization: Bearer TOKEN”

Where “TOKEN” is your Bear token, and here am assuming your dev environment has a ‘label’ of “Sandbox” (the label is case-sensitive).

You could also make a request with something like Postman and Insomnia. Both are great tools for exploring our APIs (and confirming that all the plumbing is set up OK).

Thanks.


#3

Hi, again, @snowman. Are you saying the name of the JSoN file I request should match my “Dev environment label”?

I am a long-time Fiddler (https://www.telerik.com/fiddler) user. I did not know of the Bearer TOKEN syntax, though.

I just executed this in twurl:

twurl -t -H "api.twitter.com" "/1.1/tweets/search/30day/MyDevEnviroLabel.json" -d '{"query":"snow","maxResults":"100","fromDate":"201801080000","toDate":"201801090000"}'

I got:

{“error”:{“message”:“Could not authenticate you.”,“sent”:“2018-01-09T17:37:59+00:00”,“transactionId”:“0037226d000e96ee”}}


#4

@lxcichano when you go to https://developer.twitter.com while logged in with the @handle you applied with, are you able to see the ‘Dashboard’ in the upper right corner?

If you have been approved, you should see this and be able to access the premium 30-Day search.

If you have not been approved, you will only see Apply.


#5

@happycamper, yes, I see “Search Tweets: 30-Days / Sandbox” in the dashboard, using the same account I authenticated with in twurl.

However, I do not think I ever received a notification that my application was approved. Could there be an issue with my 30-Day Search account setup?


#6

Leaving twurl out of this test, does this curl test work for you with your own label and bearer token?


#7

Thanks @snowman and @happycamper. I just noted in the aforementioned topic (30-Day API via twurl) that I had success using custom code to get the bearer token and make the request to the 30-Day API.

I appreciated twurl for making early, quick progress with the Ads API. I was wishing for a similar utility for the Premium API. Perhaps twurl support in a future version could be the solution.

I just added a feature request on GitHub.


#8

Thanks for the nudge on this. I agree that having twurl support the premium API would be very helpful, so I’ll see if this is something we can prioritise.


#9

Thanks, @andypiper. I apologize for the duplicate feature request.

At this point, I think the best answer to my original question is this FAQ.


#10