Retrieve data from a remote source
Let's start by creating a request to the remote server:
{
"request": {
"headers": {
"accept": "application/json"
},
"method": "GET",
"url": "https://api.spacexdata.com/v3/capsules/"
},
"parameters": {}
}
Now, execute the request. You can view the server's response in the "Received" tab, which will display a JSON structure. The next step is to convert this JSON into a flat table format.
Authentication
Many remote servers require authentication. Supported authentication schemes:
- Login/password
- API keys
- OAuth
To enable "API keys" authentication, add the necessary header and the TOKEN
parameter:
{
"request": {
"headers": {
"Authorization": "Bearer {$TOKEN}",
"accept": "application/json"
},
"method": "GET",
"url": "https://api.spacexdata.com/v3/capsules/"
},
"parameters": {
"TOKEN": "<insert your token here>"
}
}
To modify tokens, navigate to the "Parameters" tab.
OAuth Authentication
You can also connect to the API using OAuth authentication. To do this, add the oauth
section to the request
element:
"request": {
"oauth": {
"auth_uri": "https://oauth.saas.com/authorize",
"client_id": "d406fe048336469b5cc8a4201de848",
"client_secret": "1c377c8d105880af58ee07f6bf",
"refresh_uri": "https://oauth.saas.com/token",
"token_uri": "https://oauth.saas.com/token"
}
}
Provide the required values for:
client_id
client_secret
auth_uri
refresh_uri
token_uri
To implement OAuth, we use the library requests-oauthlib. The specific parameters for OAuth may vary across different services, so always refer to the service's documentation for guidance. You can include any parameters supported by this library.
Scripts for Collecting a Full Response
In some cases, generating a complete report requires multiple requests to the remote service. You can write a Python script to handle this, which can be edited in the "Script" tab.
For more details, refer to the documentation.