Skip to content

tiktok/ttspc-sample-shared-types

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TikTok Shop API Sample Application and Middleware Server - Shared Types

The TikTok Shop API Sample Application and Middleware Server includes an example React/Typescript frontend, and an example ExpressJS/Typescript middleware server.

It has the following architecture:

The ExpressJS server performs the following functions:

  1. Storage of secrets and user data using a simple file-based database.
  2. A REST API for user management, authorization and authentication, and TikTok Shop data for the front end UX.
  3. A typescript SDK for the TikTok Shop API.

Typescript types are shared between the frontend and backend, and are defined in the ttspc-sample-shared-types package. In most cases, the resources returned by the middleware service are simply the TikTok Shop API resource wrapped in the middleware service's payload wrapper:

export type ssaResponseWrapper<T> = {
  code: number;
  message: string;
  request_id: string;
  data: T;
}

Currently, the following TikTok Shop API URIs are supported:

  • /api/v2/token/getuser
  • /api/v2/token/refresh
  • /authorization/202309/shops
  • /product/202309/categories
  • /product/202309/categories/${categoryId}/attributes
  • /product/202309/categories/recommend
  • /product/202309/categories/${categoryId}/rules
  • /product/202312/products/create
  • /product/202312/prerequisites
  • /product/202309/products/search
  • /product/202309/images/upload

Usage

To use this package locally with the sample application, clone this repository and follow these steps:

npm install
npm run build
npm link

Once the package is linked, you can install it in the sample application:

npm link ttspc-sample-shared-types

About

TikTok Shop API Sample Application and Middleware Server - Shared Types

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors