The documentation for the Vendus API is available here. Not all endpoints are available but feel free to contribute!
First, install the module with npm (or yarn):
npm install vendus-sdk
Then, depending upon your usage context, add a reference to it:
const vendus = require("vendus-sdk");
import VendusClient from "vendus-sdk";
To use this client you must have an API Key from Vendus.
import VendusClient from "vendus-sdk";
const vendus = new VendusClient({
apiKey: process.env.VENDUS_API_KEY,
});
const client = await vendus.clients.createClient({
externalUserId: "test-user",
market: "GB",
locale: "en_US",
});
If a response is returned with a code >= 300, instead of returning the response, the response will be thrown as an error to be caught. The error has the following fields:
{
name: "Request failed",
message: "Request failed with status 404: Not found",
status: 404,
statusText: "Not found",
request: {
url: `https://www.vendus.pt/ws/v1.1/notFound`,
options: fetchOptions,
}
response: "Fetch response object"
}