1.0.4 • Published 5 years ago

@walkthechat/xiaohongshu-node v1.0.4

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

Xiaohongshu API Node.js

Xiaohongshu API bindings for Node.js.

Installation:

$ npm install --save @walkthechat/xiaohongshu-node

API

This module exports a constructor function which takes an options object.

Xiaohongshu(options)

Creates a new Xiaohongshu instance.

Arguments

  • options - Required - A plain JavaScript object that contains the configuration options.

Options

  • appKey - Required - A string that specifies the appKey generated by Xiaohongshu backend.
  • appSecret - Required - A string that specifies the appSecret generated by Xiaohongshu backend.

How to get app Key/Secret

Return value

A Xiaohongshu instance.

Exceptions

Throws an Error exception if the required options are missing.

Example

const XiaohongshuAPI = require('xiaohongshu-node');

const xiaohongshu = new XiaohongshuAPI({
  appKey: 'your-app-key',
  appSecret: 'your-app-secret',
});

Resources

Every resource is accessed via your Xiaohongshu instance:

const xiaohongshu = new XiaohongshuAPI({
  appKey: 'your-app-key',
  appSecret: 'your-app-secret',
});

// xiaohongshu.<resource_name>.<method_name>

Each method returns a Promise that resolves with the result:

xiaohongshu.spu.getList()
  .then(spus => console.log(spus))
  .catch(err => console.error(err));

Available resources and methods

  • SPU
    • create(body)
    • update(spuId, body)
    • get(spuId, query)
  • SPL
    • create(spuId, body)
    • createItem(splId, body)
    • update(splId, body)
    • updateItem(splId, body)
    • submitItem(splId, body)
  • SPV
    • create(splId, body)
    • update(spvId, body)
    • updateCustoms(spvId, body)
  • ITEM
    • create(spvId, body)
    • update(itemId, body)
    • updateLogistics(itemId, body)
    • updateAvailability(itemId, body)
    • getListLite(query)
    • getList(query)
    • get(itemId)
    • getInventory(itemId)
    • updateInventory(itemId, body)
  • PACKAGE
    • getLastest(query)
    • getStatus(query)
    • getList(query)
    • get(packageId)
    • updateShipping(packageId, body)
    • createBatch(body)
    • updateBatch(batchNo, body)
    • getlistCancelled(query)
    • updateCancelled(body)
  • BRAND
    • search(query)
  • CATEGORY
    • getList(query)
    • getVariations(categoryId, query)
    • getAttributeOptions(categoryId)
    • getAttributeValues(attributeId)

where query and body are a plain JavaScript object. See https://school.xiaohongshu.com/en/open/product/item-list.html for parameters details.

Become a master of the Xiaohongshu ecosystem:

Supported by:

License

MIT

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago