Close
logo

Asynchronous API Imports

Git RepositoryEdit on Github
Last update: a year ago by Francesco de LorenziReading time: 4 min

When building out a custom channel connection to Onport, you'll likely first develop using the synchronous API to import orders and products. This will provide feedback on validation issues and errors as the integration is being built.

When you are ready to go-live, you'll want to ensure there is sufficient throughput available for sending new orders and order updates. For example, during peak times at checkout, there may be more orders flowing in than the API throttling in the synchronous API will allow.

To solve this, we recommend migrating to the asynchronous API when production ready. This will allow higher throughput of data. While any immediate errors on the order import won't be returned within the request cycle, the errors will be visible in the API logs. For example, when integrating with a custom channel, you'll be able to access the error logs on the main sales list.

You should typically accept a 200 response from any request being sent into the endpoint.

Importing sales asynchronously

When switching to the asynchronously method, while the data structures being sent will remain the same, there will be changes to the endpoint and authentication.

  • To import sales, you'll need to migrate from the synchronous endpoint (e.g. https://api.jetti.io/api/channels/:id/manual-sale.json) to the asynchronous endpoint (https://inbound.jetti.io/webhooks/custom-channels/manual-sale.json).

  • Alongside the URL change, the authentication method will also change for the asynconrous sending of data. Instead of a Bearer Token, you'll pass a jetti-webhook-hash field in the header. We recommend retaining the Content-Type to application/json header, as with the synchronously calls.

You can find your webhook hash under Integrations > Custom channel. It will be listed on the main setup tab:

The complete request should now be as follows (payload body removed for brevity). Note the change to the URL and the header.

curl --request POST \
--url 'https://inbound.jetti.io/webhooks/custom-channels/manual-sale.json' \
--header 'Content-Type: application/json' \
--header 'jetti-webhook-hash: abcdef' \
--data '{}'

Data sent is typically reflected in the system under a minute. When sending larger volumes, this delay may be extended. Within our queue, priority is given to new data vs updates.

We will be rolling out throttling of these endpoints. We'd recommend assuming a 10x increase in your syncronous API throughput as a benchmark while we don't have any formal restrictions in place.

Importing product asynchronously

The same approach of switching to asynchronous methods applies to product import.

You can migrate from https://api.jetti.io/api/channels/:id/import-connector-variant-batches.json to https://inbound.jetti.io/webhooks/custom-channels/products.json while retaining the same payload.

Example request:

curl --request POST \
--url 'https://inbound.jetti.io/webhooks/custom-channels/products.json' \
--header 'Content-Type: application/json' \
--header 'jetti-webhook-hash: abcdef' \
--data '{}'

Asynchronously Batch Acknowledging Inventory Feed Variants

It is possible to perform asynchronous batch acknowledgement of Inventory Feed Variants by making the following request.

The payload corresponds to the one accepted by the synchronous API endpoint https://api.jetti.io/api/channels/:id/acknowledge-variant-batches.json

curl --request PUT \
--url 'https://inbound.jetti.io/webhooks/custom-channels/acknowledge-inventory-feed-variant-batches.json' \
--header 'Content-Type: application/json' \
--header 'jetti-webhook-hash: abcdef' \
--data '[
{
"sku": "{{sku}}",
"vendorSkus": [{
"vendorSku": "{{vendorSku}}",
"dropshipProviderExternalId": "{{externalId}}"
}]
},
{
"sku": "{{sku}}",
"vendorSkus": [{
"vendorSku": "{{vendorSku}}",
"dropshipProviderExternalId": "{{externalId}}"
}]
}
]
'

Asynchronously Batch Disconnecting Inventory Feed Variants

Jetti also makes it possible to perform asynchronous batch disconnection of Inventory Feed Variants by making the following request.

The payload used to call https://api.jetti.io/api/channels/:id/disconnect-variant-batches.json corresponds to the one accepted by the asynchronous endpoint.

curl --request PUT \
--url 'https://inbound.jetti.io/webhooks/custom-channels/disconnect-inventory-feed-variant-batches.json' \
--header 'Content-Type: application/json' \
--header 'jetti-webhook-hash: abcdef' \
--data '[
{
"sku": "{{sku}}",
"vendorSkus": [{
"vendorSku": "{{vendorSku}}",
"dropshipProviderExternalId": "{{externalId}}"
}]
},
{
"sku": "{{sku}}",
"vendorSkus": [{
"vendorSku": "{{vendorSku}}",
"dropshipProviderExternalId": "{{externalId}}"
}]
}
]
'
๐Ÿ’ป Custom channel โ€” Previous
Disconnecting Inventory Feed Variants
Next โ€” ๐Ÿ“ฆ Custom Carrier
Introduction