1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-07-05 18:15:24 +02:00
tldr/pages/common/twurl.md

29 lines
984 B
Markdown
Raw Normal View History

2022-10-22 23:01:22 +02:00
# twurl
> Curl-like command but tailored specifically for the Twitter API.
> More information: <https://github.com/twitter/twurl>.
- Authorize `twurl` to access a Twitter account:
`twurl authorize {{[-c|--consumer-key]}} {{twitter_api_key}} {{[-s|--consumer-secret]}} {{twitter_api_secret}}`
2022-10-22 23:01:22 +02:00
- Make a GET request to an API endpoint:
`twurl {{[-X|--request-method]}} GET {{twitter_api_endpoint}}`
2022-10-22 23:01:22 +02:00
- Make a POST request to an API endpoint:
`twurl {{[-X|--request-method]}} POST {{[-d|--data]}} '{{endpoint_params}}' {{twitter_api_endpoint}}`
2022-10-22 23:01:22 +02:00
- 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"`
2022-10-22 23:01:22 +02:00
- Access a different Twitter API host:
`twurl {{[-H|--host]}} {{twitter_api_url}} {{[-X|--request-method]}} GET {{twitter_api_endpoint}}`
2022-10-22 23:01:22 +02:00
- Create an alias for a requested resource:
`twurl alias {{alias_name}} {{resource}}`