Use this recipe when an export action already exists in the model and you want to run it through the API.
You need:
- An authentication token.
- Access to the target workspace and model.
- An existing export action.
- Permission to run the export.
- Permission to download the generated file.
Process
- Authenticate.
Request:POSThttps://auth.anaplan.com/token/authenticateSave the returned authentication token.
- Find the workspace
Request:GET /workspacesSave the
idof the workspace asworkspaceId. - Find the model
Request:GET /workspaces/{workspaceId}/modelsSave the
idof the model asmodelId. - Find the export action
Request:GET /workspaces/{workspaceId}/models/{modelId}/exportsSave the
idof the export action asexportId. - Start the export
Request:POST /workspaces/{workspaceId}/models/{modelId}/exports/{exportId}/tasksSave the returned
taskId. - Poll the export task
Request:GET /workspaces/{workspaceId}/models/{modelId}/exports/{exportId}/tasks/{taskId}Repeat this request until the export task reaches a terminal state.
- Find the generated file
Request:GET /workspaces/{workspaceId}/models/{modelId}/filesSave the
idof the generated export file asfileId. - List file chunks
Request:GET /workspaces/{workspaceId}/models/{modelId}/files/{fileId}/chunksUse the response to identify the available
chunkIdvalues. - Download each file chunk
Request:GET /workspaces/{workspaceId}/models/{modelId}/files/{fileId}/chunks/{chunkId}Download each chunk. If the file has multiple chunks, combine them in chunk order.
Result
The export action runs, creates an output file, and the integration downloads the generated file content.
Failure handling
If the export fails, check:
- Whether the integration user can run the export.
- Whether the export action still exists.
- Whether the model is busy or unavailable.
- Whether the export task completed successfully.
- Whether the generated file appears in the files list.
- Whether all file chunks were downloaded in the correct order.