@aurigma/axios-storefront-api-client

中文文档
2.69.3发布于 2026/11/05SEE LICENSE IN License.mdTypeScriptESM + CJS近 30 天下载 2865

Axios API Client for Storefront API service of Customer's Canvas web-to-print system.

原始使用文档
文档目录4 节
  1. Pre-requisites
  2. Usage
  3. NodeJs
  4. Frontend

Aurigma Customer's Canvas SDK - Storefront API Client

This module is an Axios API client for Storefront API which is a part of Customer's Canvas web-to-print system. It is supposed that you are familiar with its services and understand how to use its APIs. To learn more about Customer's Canvas and its services, refer the Getting Started section of its documentation.

The API client is automatically generated with NSwag tool. If for any reasons this API client does not work well for you, feel free to generate it yourself using Swagger document published at Customer's Canvas API Gateway.

Pre-requisites

To be able to use this package, you need to meet the following requirements:

  • You must have an account at Customer's Canvas.
  • You need to use it in Javascript\Typescript applications.

For other platforms, see the Backend services article in Customer's Canvas documentation.

Usage

Install it as a regular npm package:

npm install @aurigma/axios-storefront-api-client

NodeJs

Receive an access token through your backend as explained in the documentation and deliver it to your app.

const storefront = require("@aurigma/axios-storefront-api-client");
const axios = require("axios").default;

// You need to create external app in BackOffice with required scopes to receive clientId\clientSecret
// https://customerscanvas.com/dev/getting-started/about-backend-services.html#authorization
const clientId = "";
const clientSecret = "";
const apiUrl = "https://api.customerscanvashub.com/";

const getToken = async (clientId, clientSecret) => {
  const requestConfig = {
    method: "post",
    url: apiUrl + "connect/token",
    headers: {
      "Content-Type": "application/x-www-form-urlencoded",
    },
    data: new URLSearchParams({
      client_id: clientId,
      client_secret: clientSecret,
      grant_type: "client_credentials",
    }),
  };

  const response = await axios(requestConfig);
  return response.data["access_token"];
};

const token = await getToken(clientId, clientSecret);

And then you can call ApiClients methods with this token:

const config = new storefront.ApiClientConfiguration();
config.apiUrl = apiUrl;
config.setAuthorizationToken(token);

const buildInfoClient = new storefront.BuildInfoApiClient(config);
const buildInfo = await buildInfoClient.getInfo();

const productSpecificationsApiClient =
  new storefront.ProductSpecificationsApiClient(config);
const productSpecifications = await productSpecificationsApiClient.getAll();

Frontend

You should retrieve access token from your backend, how it's explained above.

import {
  ApiClientConfiguration,
  BuildInfoApiClient,
  ProductSpecificationsApiClient,
} from "@aurigma/axios-storefront-api-client";

// A token should be received from your backend
const token = "";
// In general you can use "https://api.customerscanvashub.com" as a base api url.
// But this url may be different for on-premises version of Customer's Canvas
const baseApiUrl = "https://api.customerscanvashub.com";

const config = new ApiClientConfiguration();
config.apiUrl = baseApiUrl;
config.setAuthorizationToken(token);

const buildInfoClient = new BuildInfoApiClient(config);
buildInfoClient.getInfo().then((data) => console.log(data));

const productSpecificationsClient = new ProductSpecificationsApiClient(config);
productSpecificationsClient.getAll().then((data) => console.log(data));

To find out what other clients are available in this module, refer Storefront API Reference.

NOTE: The class name for each client is formed as ClientNameApiClient, e.g. BuildInfo -> BuildInfoApiClient, etc.

版本与发布记录

@aurigma/axios-storefront-api-client 共发布 79 个版本,首次发布于 2022/01/12;过去 12 个月发布了 8 个版本。

版本发布日期距今
2.69.3latest2026/11/052 天前
2.68.12026/09/032 个月前
2.66.62026/07/223 个月前
2.66.12026/07/024 个月前
2.65.12026/06/045 个月前
2.63.142026/04/166 个月前

关于 @aurigma/axios-storefront-api-client 的常见问题

@aurigma/axios-storefront-api-client 是什么?

Axios API Client for Storefront API service of Customer's Canvas web-to-print system.

如何安装 @aurigma/axios-storefront-api-client?

在项目目录运行 npm install @aurigma/axios-storefront-api-client,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:axios(^1.1.3)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@aurigma/axios-storefront-api-client 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@aurigma/axios-storefront-api-client 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@aurigma/axios-storefront-api-client 可以商用吗?

@aurigma/axios-storefront-api-client 使用 SEE LICENSE IN License.md 许可。许可条款写在包内的独立文件中,请阅读该文件确认可否商用。以上为概括,不构成法律意见,请以许可原文为准。

@aurigma/axios-storefront-api-client 的下载量有多少?

根据 npm 官方下载统计,@aurigma/axios-storefront-api-client 在 2026/10/07 – 2026/11/05 这 30 天内被下载 2,865 次,日均约 96 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@aurigma/axios-storefront-api-client 还在维护吗?

最新版本 2.69.3 发布于 2026/11/05(2 天前);至今共发布 79 个版本,其中过去 12 个月发布了 8 个;首次发布于 2022/01/12。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。