Aliexpress SDK
A simple and type-safe SDK for Aliexpress (system tools, dropshipping and affiliate) APIs.
Overview
Aliexpress launched a new open platform to consume their APIs. They fully migrated and upgraded their services from the old Taobao Open Platform to the new Open Platform for International Developers. The issue is, with this update, they have yet to release a Node.js SDK.
Features
This library is an unofficial and simple SDK that can do the following:
- Compose a request, generate an encryption (method signature) and interprete the response.
- Pass the right parameters for your API call with type safe methods.
- Currently supports the system tools for authentication, Affiliate API and Dropshipping API.
Installation
npm i ae_sdk
pnpm add ae_sdk
yarn add ae_sdk
Usage
To be able to use this SDK, you must first become a developer, follow the steps to register an application, to then retrive your app_key
and app_secret
.
Lastly an access token is required to access the API, follow the steps for the authorization process described in this link. When you get your access token, make sure to pass it the client initialization as session
.
import { DropshipperClient } from "ae_sdk";
const client = new DropshipperClient({
app_key: "123",
app_secret: "123456abcdef",
session: "oauth_access_token",
});
const result = await client.productDetails({
product_id: 1005004043442825,
ship_to_country: "DZ",
target_currency: "USD",
target_language: "en",
});
console.log(result);
If the call was successfull, you will get back the following results.
Inside the data
object is the API response.
{
ok: true,
data: {
aliexpress_ds_product_get_response: {
result: {...},
rsp_code: 200,
rsp_msg: "Call succeeds",
request_id: "..."
}
}
}
Else if an error occured you will receive the following:
Make sure you to pass the right parameters, but if the problem persits, please contact me
{
ok: false,
message: "..."
}
Directly call the API
If you wish to call a different Aliexpress API that is not by the current version. You can do the following:
const result = await client.callAPIDirectly("aliexpress.api.endpoint", {
[string]: string | number | boolean,
});
Todos
- Add file parameter to pass
bytes[]
as a method argument, example: query product using an image. - Add unit tests.
- Write documentation.