{"id":13661311,"url":"https://github.com/twitter/twurl","last_synced_at":"2025-05-14T00:10:15.737Z","repository":{"id":40257411,"uuid":"341011","full_name":"twitter/twurl","owner":"twitter","description":"OAuth-enabled curl for the Twitter API","archived":false,"fork":false,"pushed_at":"2023-07-20T20:54:51.000Z","size":209,"stargazers_count":1806,"open_issues_count":13,"forks_count":298,"subscribers_count":191,"default_branch":"master","last_synced_at":"2025-05-06T20:12:33.075Z","etag":null,"topics":["cli","curl","ruby","twitter","twitter-api","twurl"],"latest_commit_sha":null,"homepage":"https://developer.twitter.com","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/twitter.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2009-10-18T05:48:53.000Z","updated_at":"2025-05-05T15:52:17.000Z","dependencies_parsed_at":"2024-01-13T03:01:01.015Z","dependency_job_id":"7d57e229-41b5-41dc-8edd-87820f551673","html_url":"https://github.com/twitter/twurl","commit_stats":{"total_commits":184,"total_committers":26,"mean_commits":7.076923076923077,"dds":0.6467391304347826,"last_synced_commit":"3604e655ad3da2f6a901db20d3529d5f95bed090"},"previous_names":["marcel/twurl"],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twitter%2Ftwurl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twitter%2Ftwurl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twitter%2Ftwurl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twitter%2Ftwurl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/twitter","download_url":"https://codeload.github.com/twitter/twurl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254044289,"owners_count":22005128,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","curl","ruby","twitter","twitter-api","twurl"],"created_at":"2024-08-02T05:01:32.365Z","updated_at":"2025-05-14T00:10:10.729Z","avatar_url":"https://github.com/twitter.png","language":"Ruby","readme":"# Twurl\n\n[![MIT License](https://img.shields.io/apm/l/atomic-design-ui.svg?)](https://github.com/twitter/twurl/blob/master/LICENSE)\n[![Gem Version](https://badge.fury.io/rb/twurl.svg)](https://badge.fury.io/rb/twurl)\n[![CI](https://github.com/twitter/twurl/actions/workflows/ci.yml/badge.svg)](https://github.com/twitter/twurl/actions/workflows/ci.yml)\n\nTwurl is like curl, but tailored specifically for the Twitter API.\nIt knows how to grant an access token to a client application for\na specified user and then sign all requests with that access token.\n\nIt also provides other development and debugging conveniences such\nas defining aliases for common requests, as well as support for\nmultiple access tokens to easily switch between different client\napplications and Twitter accounts.\n\n## Installing Twurl\n\nTwurl can be installed using RubyGems:\n\n```sh\ngem install twurl\n```\n\n## Getting Started\n\nIf you haven't already, the first thing to do is apply for a developer account to access Twitter APIs:\n\n```text\nhttps://developer.twitter.com/en/apply-for-access\n```\n\nAfter you have that access you can create a Twitter app and generate a consumer key and secret.\n\nWhen you have your consumer key and its secret you authorize\nyour Twitter account to make API requests with that consumer key\nand secret.\n\n```sh\ntwurl authorize --consumer-key key       \\\n                --consumer-secret secret\n```\n\nThis will return an URL that you should open up in your browser.\nAuthenticate to Twitter, and then enter the returned PIN back into\nthe terminal.  Assuming all that works well, you will be authorized\nto make requests with the API. Twurl will tell you as much.\n\n## Making Requests\n\nThe simplest request just requires that you specify the path you\nwant to request.\n\n```sh\ntwurl /1.1/statuses/home_timeline.json\n```\n\nSimilar to curl, a GET request is performed by default.\n\nYou can implicitly perform a POST request by passing the -d option,\nwhich specifies POST parameters.\n\n```sh\ntwurl -d 'status=Testing twurl' /1.1/statuses/update.json\n```\n\nYou can explicitly specify what request method to perform with\nthe -X (or --request-method) option.\n\n```sh\ntwurl -X POST /1.1/statuses/destroy/1234567890.json\n```\n\n## Using Bearer Tokens (Application-only authentication)\n\nYou can generate a bearer token using `--bearer` option in combination with the `authorize` subcommand.\n\n```sh\ntwurl authorize --bearer --consumer-key key       \\\n                         --consumer-secret secret\n```\n\nAnd then, you can make a request using a generated bearer token using `--bearer` request option.\n\n```sh\ntwurl --bearer '/1.1/search/tweets.json?q=hello'\n```\n\nTo list your generated bearer tokens, you can use the `bearer_tokens` subcommand.\n\n```sh\ntwurl bearer_tokens\n```\n\nThis will print a pair of consumer_key and its associated bearer token. Note, tokens are omitted from this output.\n\n## Accessing Different Hosts\n\nYou can access different hosts for other Twitter APIs using the -H flag.\n\n```sh\ntwurl -H \"ads-api.twitter.com\" \"/7/accounts\"\n```\n\n## Uploading Media\n\nTo upload binary files, you can format the call as a form post. Below, the binary is \"/path/to/media.jpg\" and the form field is \"media\":\n\n```sh\ntwurl -H \"upload.twitter.com\" -X POST \"/1.1/media/upload.json\" --file \"/path/to/media.jpg\" --file-field \"media\"\n```\n\n## Creating aliases\n\n```sh\ntwurl alias h /1.1/statuses/home_timeline.json\n```\n\nYou can then use \"h\" in place of the full path.\n\n```sh\ntwurl h\n```\n\nPaths that require additional options (such as request parameters, for example) can be used with aliases the same as with full explicit paths, just as you might expect.\n\n```sh\ntwurl alias tweet /1.1/statuses/update.json\ntwurl tweet -d \"status=Aliases in twurl are convenient\"\n```\n\n## Changing your default profile\n\nThe first time you authorize a client application to make requests on behalf of your account, twurl stores your access token information in its `~/.twurlrc` file. Subsequent requests will use this profile as the default profile. You can use the `accounts` subcommand to see what client applications have been authorized for what user names:\n\n```sh\ntwurl accounts\n  noradio\n    HQsAGcBm5MQT4n6j7qVJw\n    hhC7Koy2zRsTZvQh1hVlSA (default)\n  testiverse\n    guT9RsJbNQgVe6AwoY9BA\n```\n\nNotice that one of those consumer keys is marked as the default. To change the default use the `set` subcommand, passing then either just the username, if it's unambiguous, or the username and consumer key pair if it isn't unambiguous:\n\n```sh\ntwurl set default testiverse\ntwurl accounts\n  noradio\n    HQsAGcBm5MQT4n6j7qVJw\n    hhC7Koy2zRsTZvQh1hVlSA\n  testiverse\n    guT9RsJbNQgVe6AwoY9BA (default)\n```\n\n```sh\ntwurl set default noradio HQsAGcBm5MQT4n6j7qVJw\ntwurl accounts\n  noradio\n    HQsAGcBm5MQT4n6j7qVJw (default)\n    hhC7Koy2zRsTZvQh1hVlSA\n  testiverse\n    guT9RsJbNQgVe6AwoY9BA\n```\n\n### Profiles and Bearer Tokens\n\nWhile changing the default profile allows you to select which access token (OAuth1.0a) to use, bearer tokens don't link to any user profiles as the Application-only authentication doesn't require user context. That is, you can make an application-only request regardless of your default profile if you specify the `-c` (`--consumer-key`) option once you generate a bearer token with this consumer key. By default, twurl reads the current profile's consumer key and its associated bearer token from `~/.twurlrc` file.\n\n## Contributors\n\nMarcel Molina / @noradio\n\nErik Michaels-Ober / @sferik\n\nand there are many [more](https://github.com/twitter/twurl/graphs/contributors)!\n","funding_links":[],"categories":["Ruby"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwitter%2Ftwurl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftwitter%2Ftwurl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwitter%2Ftwurl/lists"}