LinuxCommandLibrary

twurl

Interact with Twitter via command line

TLDR

Authorize twurl to access a Twitter account

$ twurl authorize [[-c|--consumer-key]] [twitter_api_key] [[-s|--consumer-secret]] [twitter_api_secret]
copy

Make a GET request to an API endpoint
$ twurl [[-X|--request-method]] GET [twitter_api_endpoint]
copy

Make a POST request to an API endpoint
$ twurl [[-X|--request-method]] POST [[-d|--data]] '[endpoint_params]' [twitter_api_endpoint]
copy

Upload media to Twitter
$ twurl [[-H|--host]] "[twitter_upload_url]" [[-X|--request-method]] POST "[twitter_upload_endpoint]" [[-f|--file]] "[path/to/media.jpg]" [[-F|--file-field]] "media"
copy

Access a different Twitter API host
$ twurl [[-H|--host]] [twitter_api_url] [[-X|--request-method]] GET [twitter_api_endpoint]
copy

Create an alias for a requested resource
$ twurl alias [alias_name] [resource]
copy

SYNOPSIS

twurl [options] URL

PARAMETERS

-H, --header HEADER
    Adds a custom header to the HTTP request.

-d, --data DATA
    Specifies data to be sent in a POST or PUT request. It represents key-value pairs for the data, URL encoded or specified as JSON.

-X, --request COMMAND
    Specifies the HTTP request method (e.g., GET, POST, PUT, DELETE).

-t, --token TOKEN
    Specifies the OAuth token to use. Overrides the token associated with the current profile.

-s, --secret SECRET
    Specifies the OAuth token secret to use. Overrides the secret associated with the current profile.

--profile PROFILE_NAME
    Specifies the profile to use from the `.twurlrc` configuration file.

--color
    Enables color output (if supported).

--no-color
    Disables color output.

--raw
    Prints the raw HTTP response instead of the formatted JSON.

--verbose
    Displays more detailed information about the request and response, including headers.

--version
    Displays the Twurl version.

--help
    Displays help message.

DESCRIPTION

Twurl is a command-line tool that allows you to interact with the Twitter API. It's primarily used by developers to test and debug their Twitter applications, but can also be used by advanced users to manage their Twitter accounts and perform automated tasks.

Twurl handles the complexities of OAuth authentication, allowing you to make API requests without directly managing tokens and secrets. It stores authentication credentials in a configuration file, typically `~/.twurlrc`. Twurl simplifies making various Twitter API calls, such as retrieving tweets, posting updates, managing followers, and more. The tool is configurable and extensible, using Ruby-based extensions. Twurl offers a powerful, scriptable way to interact with Twitter.

CAVEATS

Twurl requires Ruby to be installed on your system. Its functionality is dependent on the Twitter API, so changes to the API may break compatibility.

CONFIGURATION

Twurl uses the `~/.twurlrc` file to store authentication credentials. This file is automatically created and updated when you authorize Twurl to access your Twitter account. You can configure multiple profiles for different Twitter accounts or applications.

AUTHENTICATION

To use Twurl, you first need to register an application with Twitter and obtain consumer key and secret. Then, you must authorize Twurl to access your Twitter account using the 'authorize' command. This process generates and stores the OAuth tokens in your `~/.twurlrc` file.

HISTORY

Twurl was developed to provide a command-line interface for interacting with the Twitter API, simplifying development and testing workflows. It gained popularity among developers for its ease of use and its ability to handle OAuth authentication. It has been continuously updated to keep pace with changes in the Twitter API.

SEE ALSO

curl(1), wget(1)

Copied to clipboard