Setting up Twurl


#1

I’ve seen many people asking about OAuth and Twurl. I’ve written a small primer for my organization and will share it here:


Twurl is twitter’s curl client. The advantage of using it is that we can pass urls around without OAuth signatures. OAuth is stored in the .twurlrc.

To generate the OAuth signatures:

  • Log in to your twitter account and find the “Keys and Access Tokens” of your app
  • Use twurl with the following commands:

account authentication:

twurl authorize --consumer-key {API-KEY} --consumer-secret {API-SECRET}

user authentication:

twurl authorize -u {USERNAME} -p {PASSWORD} --consumer-key {API-KEY} --consumer-secret {API-SECRET}

With account authentication, the user account is implied by the API credentials. If you are looking to authenticate against a separate account, use user authentication.

You can access the Ads API with such a call:

twurl -t -H ads-api.twitter.com /0/accounts | python -m json.tool

If you did both authentications above (well, not with my account) then issue this command:

twurl accounts

which will give you:

{USERNAME}
{KEY} (default)

{USERNAME}
{KEY}

You can change accounts with:

twurl set default {USERNAME}

or:

twurl set default {USERNAME} {KEY}

the latter is if you are using multiple keys.

You can probably get most of the above info with:

twurl --tutorial


Ads API calls with PHP
Can any one explain briefly about how to use ads api in initial stage and how can i give request to access analytics data
Twurl /followers/ids returns wrong followers
Conversion pixel didn't create tailored audience
Request token is required to fetch access token!
Guidelines for Reporting Issues
MISSING_PARAMETER, account_id is required
Not able to find out listed Fields from Ads API v1
Reach estimate returns error with a valid geo location id
#2

Nice! thanks for sharing here, I’m sure it will be helpful to others!


#3

Thank you fort this small tutorial! Please add “authorize” in above statement! i.e

twurl authorize --consumer-key {API-KEY} --consumer-secret {API-SECRET}


#4

You are right. Thanks for pointing this out. Not sure how/if i can update the post.


#5

@clatko feel free to open a pull request on the twurl repo integrating this step by step guide in the README - that might be a better place for this information.


#6

I agree, It would be a perfect way for many because I saw lots of people asking questions about twurl!


#7

I agree and will submit a PR right now. I still feel this information is pretty important to Ads API community and should be readily available in the search so it should not be removed.