Downloading Workflow Output via the Nexadata API
When a Workflow runs, Nexadata saves its output dataset as a CSV file. You can download that file through the Nexadata REST API, so a downstream system can pull the results directly without re-running the Workflow or reading from a destination system. This article covers the two download endpoints: one for a specific execution and one for the most recent execution of a Workflow.
Prerequisites
Section titled “Prerequisites”Before downloading Workflow output via the API, make sure you have:
-
A valid Bearer token generated from your OAuth client (see Setting Up the Nexadata REST API)
-
Either the ID of a Workflow execution or the ID of the Workflow itself:
- Execution ID: returned as the
idvalue when you execute a Workflow through the API (see Executing Workflows via the Nexadata API). You can also find it in the bottom right corner of an execution when you open it from the Workflow’s Executions view. - Workflow ID: the numerical value following
/workflow/in the address bar when viewing a Workflow in Nexadata.
- Execution ID: returned as the
Endpoints
Section titled “Endpoints”| Use case | Method | Endpoint |
|---|---|---|
| Download the output of a specific execution | GET | https://app.nexadata.com/api/v1/workflows/executions/:execution_id/output |
| Download the output of the most recent execution | GET | https://app.nexadata.com/api/v1/workflows/:workflow_id/output |
Both endpoints use the same Bearer token authentication as the rest of the Nexadata REST API.
Downloading the Output of a Specific Execution
Section titled “Downloading the Output of a Specific Execution”Every Workflow run has its own unique execution ID, so the execution ID alone is enough to identify the output you want. You do not need to supply the Workflow ID as well.
Send a GET request to the execution output endpoint, replacing 385 with your execution ID:
curl -L -X GET https://app.nexadata.com/api/v1/workflows/executions/385/output \ -H "Authorization: Bearer <your_token>"Use this endpoint when you need the results of one particular run, for example right after polling an execution until it reaches the succeeded state.
Downloading the Output of the Most Recent Execution
Section titled “Downloading the Output of the Most Recent Execution”If you only care about the latest results of a Workflow, use the Workflow ID instead. This endpoint returns the output of the most recent execution of that Workflow.
Send a GET request to the Workflow output endpoint, replacing 206 with your Workflow ID:
curl -L -X GET https://app.nexadata.com/api/v1/workflows/206/output \ -H "Authorization: Bearer <your_token>"Use this endpoint for scheduled jobs that always pick up the newest output without tracking execution IDs.
Saving the Output to a File
Section titled “Saving the Output to a File”The -L flag is required. The output endpoints do not return the CSV directly. Instead, they reply with a redirect that points to where the file is stored, and -L tells curl to follow that redirect and fetch the file. Without -L, curl stops at the redirect and you get an empty or near-empty response instead of your data. Most HTTP libraries and integration tools follow redirects automatically, so -L only matters when you use curl.
The output is always a CSV file. By default, curl prints it to your terminal. To save it to a file, add -o followed by a file name:
curl -L -X GET https://app.nexadata.com/api/v1/workflows/executions/385/output \ -H "Authorization: Bearer <your_token>" \ -o workflow-output.csvAuthorization and Access Control
Section titled “Authorization and Access Control”Access to the API is scoped to your organization. The API validates that your token belongs to an organization that has access to the requested Workflow or execution. Requests for Workflows or executions outside your organization return a 404 response.