Repository navigation
JavaScript SDK
This page is the reference for window.$vendor, the request layer of
@selldone/sdk-vendor. It lists every namespace and method
registered by VendorSDK.Setup(), the vendor API route behind each one, and the main response fields. Routes are
relative to the selldone-vapi base URL. For setup, see Getting Started.
| Global | What it is |
|---|---|
window.VAPI |
Catalog of vendor API URL builders (apis/VAPI.ts). See Vendor API URL Builders. |
window.$vendor |
Typed request wrappers: page, product, category, article, logistic. |
window.axios |
The Axios instance used by all wrappers, with the vendor's bearer token. |
Conventions:
- The first argument is always the vendor ID.
-
Lists take
(vendor_id, offset, limit, options?);optionsare sent as query parameters. -
Promises resolve with the response body. They reject with the API error body (
{ error: true, error_msg, code }) or with an Axios error. - Each namespace extends
APIAbstractfrom Selldone Core, so.optimize(seconds),.force(),.cancellation()andpromise.cache(callback)work exactly as in the Backoffice SDK.
| Method | Route | Response |
|---|---|---|
list(vendor_id, offset, limit, options?) |
GET /vendors/{vendor_id}/products/all-admin |
{ folders, products, parent_folders, total, tax_profile?, valuation?, time_filter? } |
getInfo(vendor_id, product_id, offset, limit, options?) |
GET /vendors/{vendor_id}/products/{product_id}/admin |
{ product, product_data, orderQue } |
setQuantity(vendor_id, product_id, quantity) |
POST /vendors/{vendor_id}/products/{product_id}/quantity |
{ success, quantity } |
changeCategory(vendor_id, product_id, category_id, bundle?) |
PUT /vendors/{vendor_id}/products/{product_id}/edit/category |
{ success, count } |
-
listoptions:statuses,types,sort,available,set("default"or"spec"),dir(category ID),with_product_variants,with_parent,search,vendor,products_only,with_total,show_deletes,show_vendors. -
getInfooption:with_trashed. Theproductobject includesproduct_variants,images,category,vendor,subscription_prices,extra_pricings,articlesand more. -
changeCategory: passnullascategory_idto move the product to the root.bundleis an optional array of product IDs to move together.
| Method | Route | Response |
|---|---|---|
send(vendor_id, dataset, keep_image_urls = true) |
POST /vendors/{vendor_id}/import/products |
{ success, success_count, fail_count, errors } |
info(vendor_id) |
GET /vendors/{vendor_id}/importing |
{ importing, images } |
que.products(vendor_id, offset, limit, options?) |
GET /vendors/{vendor_id}/import/products |
{ products, total } |
que.removeProduct(vendor_id, item_id) |
DELETE /vendors/{vendor_id}/import/products/{item_id} |
{ success, id } |
que.images(vendor_id, offset, limit, options?) |
GET /vendors/{vendor_id}/import/images |
{ images, total } |
que.removeImage(vendor_id, item_id) |
DELETE /vendors/{vendor_id}/import/images/{item_id} |
{ success, id } |
que.syncImage(vendor_id, item_id) |
PUT /vendors/{vendor_id}/import/images/{item_id}/try |
{ success, id } |
send requires the first row of dataset to be an array of header strings; otherwise it throws before sending.
Columns match the backoffice importer (Title, Type, Price, Currency, Status, Quantity, SKU, Category,
Images, V_Color, …; see vapi.product.importer.post.IProduct). Queue options: sortBy, sortDesc, search.
| Method | Route | Response |
|---|---|---|
set(vendor_id, product_id, tags) |
POST /vendors/{vendor_id}/products/{product_id}/tags |
{ success, tags } |
| Method | Route | Response |
|---|---|---|
remove(vendor_id, product_id, variant_id) |
DELETE /vendors/{vendor_id}/products/{product_id}/variants/{variant_id}/delete |
{ success, variants, quantity, variant_id } |
restore(vendor_id, product_id, variant_id) |
POST /vendors/{vendor_id}/products/{product_id}/variants/{variant_id}/restore |
{ success, variants, quantity, variant_id } |
| Method | Route | Response |
|---|---|---|
list(vendor_id, product_id, offset, limit, options?) |
GET /vendors/{vendor_id}/products/{product_id}/vendors |
{ vendor_products, total } |
Options: sortBy, sortDesc, search, vendor_id.
| Method | Route | Response |
|---|---|---|
list(vendor_id, offset, limit, options?) |
GET /vendors/{vendor_id}/categories |
{ categories, total, parent_folders } |
Options: contain, updated_at (ISO 8601), sortBy (id, name, title, star, icon, parent_id, visits,
products, categories, vendor_id, page_id, created_at, updated_at), sortDesc, search, children,
parent, page.
| Method | Route | Response |
|---|---|---|
getPageAugment(vendor_id, page_id, current_augment?) |
GET /vendors/{vendor_id}/pages/{page_id}/augment |
{ augment } |
Returns the augment items of a page ({ key, value, type: "image" | "text" }). If you pass current_augment, the
SDK merges it with the server structure.
| Method | Route | Response |
|---|---|---|
tags.getTags(vendor_id) |
GET /vendors/{vendor_id}/articles/tags |
{ tags } |
tags.setArticleTags(vendor_id, article_id, tags) |
POST /vendors/{vendor_id}/articles/tags/{article_id} |
{ tags } |
| Method | Route | Response |
|---|---|---|
profile.list(vendor_id, offset, limit, options?) |
GET /vendors/{vendor_id}/logistic-profiles |
{ profiles, total } |
Options: sortBy, sortDesc, search, contain, compact, type (a LogisticProfileType key).
const productsApi = window.$vendor.product.cancellation(); // drop superseded searches
function loadProducts(search, page = 1, perPage = 20) {
return productsApi
.list(VENDOR_ID, (page - 1) * perPage, perPage, {
search,
products_only: true,
with_total: true,
})
.then(({ products, total }) => ({ products, total }))
.catch((error) => {
if (error === undefined) return null; // canceled by a newer request
throw error;
});
}