Importing Inventory
In the process of integrating custom dropship providers with Onport, it is important to start with syncing new and existing products/variants with Onport. This task can be accomplished in two main ways:
- push : An external system sends API calls to Onport to notify about updates inventory items
- pull : Onport regularly pulls the list of inventory items from an endpoint
Push Data Flow
To get started, you'll need to add a new dropship provider and inventory feed. You can do this within the Onport admin dashboard. For the inventory feed, you'll need to set the inventory feed resource type to webhook
.
If you want to achieve the above steps programatically (e.g. using the Onport API instead of through the admin dashboard), you can use the POST /api/dropship-providers.json
and POST /api/inventory-feed.json
endpoints.
More information can be found in the following articles:
Adding inventory feed variants
Once you've set up the feed, you'll then need to add the inventory feed variants. This can either be done in batch (up to 50 at a time asynchronously) or individually synchronously.
To add your first inventory feed variant, you'll need to do a PUT
request against /api/inventory-feeds/:id/parse-webhook.json
with the following payload:
{"externalId": "1234","vendorSku": "1234","inventoryQuantity": 10}
For a full list of the attributes to send to the endpoint, you can look up the inventory-feed-variants
resource in the API Reference portal.
It is also possible to make asynchronous calls to Jetti's Inbound API to increase the throughput of requests. Below is an example cURL Request:
curl --request POST \--url 'https://inbound.jetti.io/webhooks/inventory-feeds/parse-webhooks.json' \--header 'Content-Type: application/json' \--header 'jetti-webhook-hash: inventory-feed-hash' \--data '[{externalId: "abc",vendorSku: "abc",inventoryQuantity: 100,}]'
The hash can be found by looking up the hash
field from response returned by GET https://api.jetti.io/api/inventory-feeds/:id.json
Auto-connecting and updating
When you use the parse-webhook.json
endpoint, it will handle all of the validation of triggers for you. For example, if you have enabled the automated connection by SKU feature in the inventory feed, the item will automatically connect to a variant matching the SKU.
The externalId
if used to track the unique item. This is usually the ID of the item in the external system. If you want to update the item, you can use the same endpoint and data used to create the original item, as Onport will effectively do an UPSERT type operation using this endpoint.
Alternatively, once the inventory feed variant is created, you can use the inventory-feed-variants.json endpoint to pull a list of the inventory feed variants. Then, perform a PUT request on any of the items (e.g. inventory-feed-variants/:id.json
).
Daily Limits
The number of inventory feed variants that can be updated on a daily basis corresponds to the SKU limit in the Onport Subscription plan.
Pull Data Flow
The opposite data flow is Pull. In this case, Onport regularly contacts an API endpoint or downloads a file from a URL.
FTP/HTTPS CSV
In order to be able to download a CSV file from a remote HTTP(S) or FTP server, you need to select FTP & HTTP(S) CSV while configuring your Inventory Feed.
Onport fully supports password protected resources, according to the RFC 1738 specifications.
Here are some example URLs Onport supports:
http://username:password@host/path/to/file.csvhttps://username:password@host/path/to/file.csvftp://username:password@host/path/to/file.csvftps://username:password@host/path/to/file.csv
FTP/HTTPS XML
Onport fully supports password protected resources for XML downloads as well.
The CSV/XML response can be downloaded from a file hosted on a remote FTP/HTTP(s) server as well as a web application returning CSV/XML response programmatically.
In all cases, Onport makes GET
calls to such resources.
As for mapping, Onport supports XPath.
REST API
If REST API is selected, Onport calls the API URL provided by making a GET
call. A default JSON response can be returned by the server.
Alternatively, as it happens for XML and CSV, it is possible to perform custom mapping with the JSON fields.