Uploading via HTTP (JSON)

This API is currently in beta. Please share your feedback with our partners team!
The JSON API allows you to upload stock updates as they happen, for the most real-time integration with NearSt. Stock updates will be processed within seconds, and pushed to the NearSt channels.
Note: At the moment, we recommend using the JSON API for real-time stock updates in combination with uploading a full stock feed through the FTP gateway or HTTP CSV upload endpoints every 24 hours, to ensure products with limited stock moments don't expire (NearSt stops showing any products it hasn't received updates for in the last 7 days).

API specification

put
https://stock.near.live
/inventory
Send one or more real-time stock updates

Example payload

{
"inventory": [
{
"barcode": "123456789012",
"quantity": 13,
"price": 5.99,
"currency": "USD"
}
]
}

Example code

cURL:
curl --request PUT 'https://stock.near.live/inventory' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {token}' \
--data-raw '{"inventory":[{"barcode":"123456789012","quantity":13,"price":5.99}]}'
Node.js using Axios:
const axios = require('axios');
async function uploadToNearSt(uploadKey, inventory) {
const config = {
method: 'put',
url: `https://stock.near.live/inventory`,
headers: {
'Authorization': `Bearer ${uploadKey}`
},
data: {inventory}
};
await axios(config);
};
// Example:
const inventory = [
{
barcode: '123456789012',
quantity: 13,
price: 5.99,
currency: 'USD'
}
];
await uploadToNeartSt(myUploadKey, inventory);