Skip to content

Instantly share code, notes, and snippets.

Common options:
-t, --[no-]trace Trace request/response traffic (default: --no-trace)
-d, --data [data] Sends the specified data in a POST request to the HTTP server.
-r, --raw-data [data] Sends the specified data as it is in a POST request to the HTTP server.
-A, --header [header] Adds the specified header to the request to the HTTP server.
-H, --host [host] Specify host to make requests to (default: api.twitter.com)
-q, --quiet Suppress all output (default: output is printed to STDOUT)
-U, --no-ssl Disable SSL (default: SSL is enabled)
-X, --request-method [method] Request method (default: GET)
-P, --proxy [proxy] Specify HTTP proxy to forward requests to (default: No proxy)
example$ brew update
example$ brew install ruby
// Check to see if Gem is installed...
example$ gem -v
// Once in the system, install Twurl
example$ gem install twurl
// In order to install Twurl, you need Chocolately...
// Run CMD as Admin or do as I do and use PyCharm's Terminal.
// Install Ruby...
example$ choco install ruby
// Install Twurl...
example$ gem install twurl
example$ twurl authorize --consumer-key KEY --consumer-secret SECRET
Go to https://api.twitter.com/oauth/authorize?XXXXXXX and paste in the supplied PIN
XXXXXXX
Authorization successful
JSON Request 👇
POST https://api.twitter.com/1.1/statuses/update.json?status=Hello!%20This%20Tweet%20was%20sent%20via%20the%20Twitter%20API.
Twurl Request 👇
twurl -X POST -H api.twitter.com "/1.1/statuses/update.json?status=Hello! This Tweet was sent via the Twitter API." | jq
example$ twurl -X POST -H api.twitter.com "/1.1/statuses/update.json?status=@SamSchmir Hello again. This Tweet was sent via the Twitter API.&in_reply_to_status_id=983114141538844672&media_ids=983116742619643905&nullcast=true" | jq
// JSON Request 👇
POST https://ads-api.twitter.com/3/accounts/YOUR_ADS_ACCOUNT_ID/cards/website?image_media_key=3_955505955445268480&name=website card&website_title=Twitter Developers&website_url=https://developer.twitter.com
// Twurl Request 👇
example$ twurl -X POST -H ads.twitter.com "/3/accounts/YOUR_ADS_ACCOUNT_ID/cards/website?iamge_media_key=3_983137386224697344&name=example website card&website_title=Twitter Developers&website_url=https://developer.twitter.com" | jq
{
"created_at": "Sun Apr 08 23:08:33 +0000 2018",
"id": 983119433458692100,
"id_str": "983119433458692097",
"text": "@SamSchmir Hello again. This Tweet was sent via the Twitter API. https://t.co/01FeJY01hV",
"truncated": false,
"entities": {
"hashtags": [],
"symbols": [],
"user_mentions": [
{
"data": {
"name": "websitecard",
"website_shortened_url": "https://t.co/NqiedsZEbj",
"image_display_height": "627",
"image": "https://pbs.twimg.com/media/DaTOPm9UQAAB2LW.jpg",
"preview_url": null,
"website_display_url": "developer.twitter.com",
"id": "5k8ik",
"account_id": "18ce54h6ntv",
example$ twurl -X POST -H api.twitter.com "/1.1/statuses/update.json?status=Example Image Website Card&card_uri=card://983323519860781056&nullcast=true" | jq