Linux command
twurl 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Authorize account
twurl authorize --consumer-key [key] --consumer-secret [secret]
GET request
twurl [/2/users/me]
POST request
twurl -X POST [/2/tweets] -d '{"text":"Hello"}'
List accounts
twurl accounts
Set default account
twurl set default [username]
说明
twurl is an OAuth-enabled curl replacement specifically designed for the Twitter (X) API. It handles the OAuth authentication handshake automatically, allowing developers to make authenticated API requests without manually managing tokens in each request. After initial authorization with consumer key and secret, twurl stores credentials and signs all subsequent requests. Multiple accounts can be authorized and switched between, making it easy to test API calls across different users. All Twitter API endpoints are accessible via standard HTTP methods. Requests support custom headers and JSON request bodies for POST operations. The tool is particularly useful for API exploration and debugging during Twitter application development.
参数
- -X _METHOD_
- HTTP method.
- -d _DATA_
- Request body.
- -H _HEADER_
- Custom header.
- authorize
- Set up OAuth.
- accounts
- List accounts.
FAQ
What is the twurl command used for?
twurl is an OAuth-enabled curl replacement specifically designed for the Twitter (X) API. It handles the OAuth authentication handshake automatically, allowing developers to make authenticated API requests without manually managing tokens in each request. After initial authorization with consumer key and secret, twurl stores credentials and signs all subsequent requests. Multiple accounts can be authorized and switched between, making it easy to test API calls across different users. All Twitter API endpoints are accessible via standard HTTP methods. Requests support custom headers and JSON request bodies for POST operations. The tool is particularly useful for API exploration and debugging during Twitter application development.
How do I run a basic twurl example?
Run `twurl authorize --consumer-key [key] --consumer-secret [secret]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -X _METHOD_ do in twurl?
HTTP method.