Fetching AMC results with a download URL
In short: After you start an execution the API returns a workflowExecutionId. With the instance ID and this ID you call the downloadUrls endpoint and receive a pre-signed URL for the result CSV. If the report is not ready yet, the API answers that the execution is unavailable for download.
Which route when
The download URL works for every instance, even if you have not connected an S3 bucket. Reports can then only be retrieved through this URL. With a bucket you can additionally use the download URL to fetch the result of one specific execution.
What the documentation leaves open
The page we read does not state how long the pre-signed URL stays valid. Download the file right after the request and do not store the URL long term.
Step by step
- Start the execution. Start the workflow through the workflowExecutions resource and note the workflowExecutionId from the response.
- Request the download URL. Call GET /amc/reporting/{instanceId}/workflowExecutions/{workflowExecutionId}/downloadUrls with the instance ID and execution ID.
- Download the CSV. Open the returned URL or fetch it with a script. If the report is not ready yet, repeat the request later.