Close
logo

Polling the API for Data Exports

Git RepositoryEdit on Github
Last update: 2 years ago by luigi mangaReading time: 2 min

Jetti's asynchronous data exports such as inventory levels, inventory feeds, dropship providers send a message to the email address associated to the user that requested the export. The message contains an attachment with the generated export. However, there may be situations in which external systems need to download the exported document programmatically and process it.

Most asynchronous data exports return an object which is similar to the example below:

{
"displayName": "inventory_feed",
"read": false,
"muteError": false,
"id": <id>,
"companyId": <companyId>,
"userId": <userId>,
"status": "pending",
"exportType": "inventory_feed",
"inventoryFeedId": <inventoryFeedId>,
"updatedAt": "2021-07-12T16:03:02.372Z",
"createdAt": "2021-07-12T16:03:02.372Z",
"fileUri": null,
"queuedAt": null,
"startedAt": null,
"completedAt": null,
"inventoryExportId": null,
"stockTakeId": null,
"inventory_import_id": null,
"intercomMessageId": null,
"adminNotes": null,
"dropshipProviderId": null,
"templateId": null
}

The id field represents the ID of the Data Export.

It is possible to poll the Data Exports endpoint by making a GET call to https://api.jetti.io/api/data-exports.json

curl --request GET \
--url https://api.jetti.io/api/data-exports.json \
--header 'Authorization: Bearer {{token}}' \
--header 'Content-Type: application/json'

Onport will return an array of Data Exports along with their statuses and URLs to download the files. More information on the Data Export endpoint is available via Onport's API Reference.

[
{
"id": <id>,
"companyId": <companyId>,
"inventoryFeedId": null,
"dropshipProviderId": null,
"inventoryExportId": <inventoryExportId>,
"templateId": null,
"stockTakeId": null,
"userId": <userId>,
"fileUri": "https://url-to-file.csv",
"status": "complete",
"read": false,
"exportType": "inventory_levels",
"queuedAt": null,
"startedAt": null,
"completedAt": "2021-07-12T16:48:35.091Z",
"createdAt": "2021-07-12T16:48:34.682Z",
"updatedAt": "2021-07-12T16:48:35.092Z",
"muteError": false,
"adminNotes": null,
"intercomMessageId": null
},

For each Data Export, the status is changed from pending to complete once the asynchronous export is completed.

The fileUri field is populated with the direct URL to download the export.

You can also get the details of a specific Data Export by making a GET call to: https://api.jetti.io/api/data-exports/:id.json

More information on Onport's rate limit on API calls is available in the Getting Started => Connecting article.

๐Ÿ“‚ Exports โ€” Previous
Exporting Variants from all Feeds
Next โ€” ๐Ÿ” API Pipeline
Commission Pipe