Retrieve Invocation Results
After creating an invocation, you can retrieve the status of the invocation by using the endpoint /api/invocation/{invocationId}.
- Curl
- Python
curl --location 'https://nostradamus.u-hopper.com/api/invocation/{invocation-id}' \
--header 'Authorization: Token my-secret-token'
import requests
url = "https://nostradamus.u-hopper.com/api/invocation/{invocation-id}"
payload = {}
headers = {
'Authorization': 'Token my-secret-token',
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
When the status of request changes to completed is possible to access the invocationResults key and see what results and in which formats these are available for download, including json, csv and xlsx.
In fact, an invocation can produce multiple results, and each result can be available in different formats.
The primary result is the one that is considered the main result of the invocation while the others are accessory results.
The value of the invocationResults key will be similar to the following example:
{
"resultId": {
"primaryResult": true,
"status": "completed",
"jsonAvailable": true,
"csvAvailable": true,
"xlsxAvailable": true
}
}
where:
resultIdis the id of the result;primaryResultis a boolean that indicates if the result is the primary result;statusis the status of the result (it can becompleted,error);jsonAvailableis a boolean that indicates if the result is available in json format;csvAvailableis a boolean that indicates if the result is available in csv format;xlsxAvailableis a boolean that indicates if the result is available in xlsx format.
The primary result can be downloaded in different formats, including json, csv and xlsx by using the following endpoints, respectively:
/api/invocation/{invocationId}/jsonto retrieve the results in JSON format;/api/invocation/{invocationId}/csvto retrieve the results in CSV format;/api/invocation/{invocationId}/xlsxto retrieve the results in XLSX format.
The following example shows how to retrieve the primary result of an invocation in JSON format:
- Curl
- Python
curl --location 'https://nostradamus.u-hopper.com/api/invocation/my-invocation-request-id/json' \
--header 'Authorization: Token my-secret-token'
import requests
url = "https://nostradamus.u-hopper.com/api/invocation/my-invocation-request-id/json"
payload = {}
headers = {
'Authorization': 'Token my-secret-token'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
The response will contain the results of the invocation in JSON format. The structure of the response will depend on the type of invocation that was performed: find out more in the following sections.
All the results can be downloaded in different formats, including json, csv and *xlsx by using the following endpoints, respectively:
/api/invocation/{invocation-id}/result/{result-id}/json;/api/invocation/{invocation-id}/result/{result-id}/csv;/api/invocation/{invocation-id}/result/{result-id}/xlsx.
The following example shows how to retrieve the result of an invocation in JSON format:
- Curl
- Python
curl --location 'https://nostradamus.u-hopper.com/api/invocation/{invocation-id}/result/{result-id}/json' \
--header 'Authorization: Token my-secret-token'
import requests
url = "https://nostradamus.u-hopper.com/api/invocation/{invocation-id}/result/{result-id}/json"
payload = {}
headers = {
'Authorization': 'Token my-secret-token',
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)