Add scripts
GET https://api.twitter.com/2/tweets/:id
You can add JavaScript that executes before or after a request runs. These [pre-request and test scripts] are useful for setting and getting variable values. Writing scripts is also good for debugging, like logging output to the console. If you find yourself re-using a lot of scripts, you can add them to entire collections or folders to run along with every request within that collection or folder.
Twitter example
Look under the Pre-request Script tab to see how Twitter authorizes each request for their v2 API.
This pre-request script retrieves a Bearer token from the client credentials you provide in your environment file.
The Twitter v2 collection includes a pre-configured environment setting. You will be needing to set up below variables in order to run each request:
Name | Description |
---|---|
consumer_key | Your OAuth consumer key |
consumer_secret | Your OAuth consumer secret |
access_token | Your OAuth access token |
token_secret | Your OAuth access token secret |