You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/** * LazadaAPI class constructor * @param {string} appKey * @param {string} appSecret * @param {Venture} countryCode @ref: 'src/LazadaClient/constants.js' * countryCode should be one of the following * | 'SINGAPORE' * | 'THAILAND' * | 'MALAYSIA' * | 'VIETNAM' * | 'PHILIPPINES' * | 'INDONESIA' * @param {string?} accessToken require for some API */constaLazadaAPI=newLazadaAPI(appKey,appSecret,'SINGAPORE')// ORconstaccessToken='some_access_token'constaLazadaAPIWithToken=newLazadaAPI(appKey,appSecret,'SINGAPORE',accessToken)
Call API action with proper parameters
// all API action return promiseaLazadaAPI.generateAccessToken({code: 'auth_code'}).then(response=>{const{ access_token }=response// JSON data from Lazada's API})// for API action that require authorization, you must set the accessToken firstaLazadaAPI.accessToken='some_access_token'aLazadaAPI.getShipmentProviders().then(response=>{// JSON data from Lazada's API})
For available API actions, check the support table. For proper API request parameters, check Lazada's offcial documentation and source code located in src/LazadaClient/<namespace>
API Support
Order
status
getDocument
✔️
getFailureReasons
✔️
getMultipleOrderItems
✔️
getOrder
✔️
getOrderItems
✔️
getOrders
✔️
setInvoiceNumber
✔️
setStatusToCanceled
✔️
setStatusToPackedByMarketplace
✔️
setStatusToReadyToShip
✔️
Product
status
createProduct
✔️
getBrands
✔️
getCategoryAttributes
✔️
getCategoryTree
✔️
getProducts
✔️
getQcStatus
🚫
getResponse
🚫
migrateImage
✔️
migrateImages
🚫
removeProduct
✔️
setImages
✔️
updatePriceQuantity
✔️
updateProduct
✔️
uploadImage
🚫
Finance
status
getPayoutStatus
🚫
getTransactionDetails
🚫
Logistics
status
getShipmentProviders
✔️
Seller
status
getSeller
🚫
updateSeller
🚫
updateUser
🚫
System
status
generateAccessToken
✔️
refreshAccessToken
✔️
DataMoat
status
dataMoatBatchLog
🚫
dataMoatComputeRisk
🚫
dataMoatLogin
🚫
dataMoatOrder
🚫
Development
Tools
node - runtime
babel - js transpiler
flow - type checker
jest - test runner
eslint - linter
vscode - recommended text editor
Convention
sdk variables: camelCase
api variables: snake_case or PascalCase
File structure
src/
├── LazadaAPI // LazadaAPI: top level controller class
│ └── index.js
├── LazadaClient // LazadaClient: namespace seperated API actions
│ ├── index.js
│ ├── logistics.js
│ ├── order.js
│ ├── product.js
│ └── system.js
├── LazadaRequest // LazadaRequest: responsible for network request
│ ├── index.js
│ └── signature // logic for signing API request
│ └── index.js
├── __tests__ // all tests located here
└── index.js // a.k.a. main.c
Design
constAPIRequest={appKey: ":require",appSecret: ":require",baseURL: ":require"// Protocol (default: https) + Gateway (location specific)HttpAction: "GET OR POST",// API specificapiPath: "action/path",// API specificaccessToken: ":optional",// API specificpayload: {}// API specific};