Task 5 - Download Output of Job
In Task 5, you will retrieve the outputs produced by the job you submitted in Task 3. In this case, there should be only a single output. You will then download the outputs.
By the end of this task, you will know how to:
- Retrieve the outputs of a job
- Download the outputs
You will use the following operations for this task:
Operation | Method + Endpoint |
---|---|
Get a job’s outputs | GET queues/{queueId}/jobs/{jobId}/outputs |
Get a download URL for a resource | GET spaces/{spaceId}/resources/{resourceId}/download-url |
Step 1 - Get the outputs of the job
Use the Get a job’s outputs operation to retrieve the list of outputs produced by the job.
Request
curl -v 'https://developer.api.autodesk.com/flow/compute/v1/queues/@default/jobs/<JOB_ID_FROM_STEP_3>/outputs' \
-X 'GET' \
-H 'Authorization: Bearer <ACCESS_TOKEN_FROM_TASK_1>' \
Response
{
"results": [
{
"path": "/execute bifrost graph/0/tutorialResult",
"resourceId": "a3cbe733-bdcd-48e8-ac93-429b3e7c7109",
"spaceId": "outputs:fa8270a2-b32e-43d5-8f7b-3771fd46277e",
"urn": "urn:adsk:fc.outputs:us.prd:resource:fa8270a2-b32e-43d5-8f7b-3771fd46277e/a3cbe733-bdcd-48e8-ac93-429b3e7c7109"
}
]
}
Show More
Step 2 - Get a download url for the output
Use the Get a download URL for a resource operation to get a signed URL to download the output.
Request
curl -v 'https://developer.api.autodesk.com/flow/storage/v1/spaces/<SPACE_ID_FROM_STEP_1_RESPONSE>/resources/<RESOURCE_ID_FROM_STEP_1_RESPONSE>/download-url' \
-X 'GET' \
-H 'Authorization: Bearer <ACCESS_TOKEN_FROM_TASK_1>' \
response
{
"url": "https://s3.amazonaws.com/com.autodesk.oss-temporary/a3/d6/c2/...",
"size": 25366004,
"sha1": "a3d6c2895d51bd7f9fb22ef69852d413082bcad8"
}
Step 3 - Download result file using the signed URL
curl -X GET "<URL_FROM_STEP_2_RESPONSE>" --output "<PATH_WHERE_TO_DOWNLOAD_RESULT_USD_FILE>"