Mass Updating Dropship Providers

Git RepositoryEdit on Github
Last update: 7 months ago by Francesco de LorenziReading time: 2 min

While managing a large database of dropship providers, it may be necessary to mass update some properties (e.g. commission rates).

This can be done programmatically by using Jetti's API.

The below script shows how to set a commissionRate of 20.00 to all the Dropship Providers having a tag named test

import Bottleneck from 'bottleneck';
import pino from 'pino';
import request from 'request-promise-native';
const logger = pino({
prettyPrint: true,
const limiter = new Bottleneck({
maxConcurrent: 1,
minTime: 2000,
// Throttle the requests
const throttle = async (...params) => limiter.schedule(() => request(...params));
const headers = {
Authorization: `Bearer ${process.env.TOKEN}`,
const tags = ["test"];
const payload = {
commissionRate: "20.00"
const go = async () => {'Fetching List of Dropship Providers');
const dropshipProviders = await throttle({
method: 'GET',
uri: `${process.env.API_HOST}/api/dropship-providers.json`,
json: true,
qs: {
where: {
internalTags: {
$contains: tags
});'Making PUT request with following payload:');;,'dropshipments to be updated');
for(const dropshipProvider of dropshipProviders) {"Updating Dropship Provider ID",;
const putDropshipProvider = await throttle({
method: 'PUT',
uri: `${process.env.API_HOST}/api/dropship-providers/${}.json`,
json: true,
body: payload
if(putDropshipProvider && {"Dropship Provider",,"updated");
}else{"Unable to update Dropship Provider",;

The script expects the following environment variables

⌨️ Dropship Providers — Previous
Creating Dropship Provider Addresses
Next — 💻 Vendor Integration
Importing Inventory