Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@kintone/rest-api-client-wechat-mp

Package Overview
Dependencies
Maintainers
20
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kintone/rest-api-client-wechat-mp

kintone REST API client for WeChat Mini Program

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
20
Created
Source

kintone-rest-api-client-wechat-mp

npm version

An API client for Kintone REST API, it is used in WeChat Mini Program client.
It is based on @kintone/rest-api-client@v1.2.0.
It wraps the functions of app, record and bulkRequest of "@kintone/rest-api-client", and develops the new functions of file.

Requirement

  • WeChat Developer Tool (The latest)
    Base library version of the Mini Program: 2.2.2 or later

Usage

Step 1

Open WeChat Developer Tool and create a new project. (Ref. 小程序开发指南)

Step 2

Install with npm

cd [your-project-directory]
npm init -y
npm install @kintone/rest-api-client-wechat-mp

Step 3

Modify the setting of "WeChat Developer Tool"
Check the setting "增强编译" and "使用npm模块". (Ref. 代码编译 - 增强编译)

Build npm
Click "工具" > "构建npm" (Ref. npm 支持)

Sample code

const {KintoneRestAPIClientWeChatMP} = require('@kintone/rest-api-client-wechat-mp');
const client = new KintoneRestAPIClientWeChatMP({
  baseUrl: "https://example.cybozu.com",
  // Use password authentication
  auth: {
    username: process.env.KINTONE_USERNAME,
    password: process.env.KINTONE_PASSWORD,
  },
  // Use API token authentication
  // auth: { apiToken: process.env.KINTONE_API_TOKEN }
});

client.record
  .getRecords({ app: "1" })
  .then((resp) => {
    console.log(resp.records);
  })
  .catch((err) => {
    console.log(err);
  });

Parameters for KintoneRestAPIClientWeChatMP

NameTypeRequiredDescription
baseUrlStringRequiredThe base URL for your Kintone environment.
It must start with https. (e.g. https://example.kintone.com)
authObjectRequiredThe object for authentication. See Authentication.
guestSpaceIdNumber or StringThe guest space ID. If you are dealing with apps that are in guest spaces, please specify this.
basicAuthObjectIf your Kintone environment uses Basic authentication, please specify its username and password.
basicAuth.usernameStringThe username of Basic authentication.
basicAuth.passwordStringThe password of Basic authentication.

Authentication

The client supports three authentication methods:

  1. Password authentication
  2. API token authentication

The required parameters inside auth are different by the methods. The client determines which method to use by passed parameters.

1. Parameters for Password authentication
NameTypeRequiredDescription
usernameStringYesUser's login name
passwordStringYesUser's password
2. Parameters for API token authentication
NameTypeRequiredDescription
apiTokenString or String[]YesYou can pass multiple api tokens as an array of string.

References

The usage of following functions is not changed, you can refer to the doc of "@kintone/rest-api-client".
Pay attention to the class name, you should use KintoneRestAPIClientWeChatMP in WeChat. Refer to Sample code.

License

Copyright(c) Cybozu, Inc.

Keywords

FAQs

Package last updated on 11 Sep 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc