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

@kintone/rest-api-client

Package Overview
Dependencies
Maintainers
3
Versions
131
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kintone/rest-api-client

Kintone REST API client for JavaScript

  • 5.5.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6.5K
increased by8.56%
Maintainers
3
Weekly downloads
 
Created
Source

kintone-rest-api-client

npm version Node.js version License

API client for Kintone REST API. It supports both browser environment (Kintone customization & plugin) and Node.js environment.

Installation

1. Install with npm

This library is distributed on npm.

npm install @kintone/rest-api-client

You can then use require or import to import the library.

// CommonJS
const { KintoneRestAPIClient } = require("@kintone/rest-api-client");
// ES modules
import { KintoneRestAPIClient } from "@kintone/rest-api-client";

2. UMD files (for browser environment)

This library also provides two Universal Module Definition (UMD) files:

After loading this, you can use KintoneRestAPIClient directly. In Kintone customization, please add this URL in "JavaScript and CSS Customization" setting of your app.

NOTE: The UMD links are using the latest tag to point to the latest version of the library. This pointer is unstable, it shifts as we release new versions. You should consider pointing to a specific version, such as 1.0.0.

Browsers support

Edge
Edge
Firefox
Firefox
Chrome
Chrome
Safari
Safari
Latest versionLatest versionLatest versionLatest version

Usage

Here is a sample code that retrieves records of an app.

const client = new KintoneRestAPIClient({
  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 }
  // Use OAuth token authentication
  // auth: { oAuthToken: process.env.KINTONE_OAUTH_TOKEN }

  // Use session authentication if `auth` is omitted (in browser only)
});

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

Global

NameTypeDescription
versionStringProvides the used version of KintoneRestAPIClient.

Parameters for KintoneRestAPIClient

NameTypeRequiredDescription
baseUrlStringConditionally
Required
The base URL for your Kintone environment.
It must start with https. (e.g. https://example.kintone.com)
Required in Node.js environment. If you omit it in browser environment, location.origin will be used.
The protocol of baseUrl must be https except when hostname is localhost.
authObjectConditionally
Required
The object for authentication. See Authentication.
guestSpaceIdNumber or StringThe guest space ID. If you are dealing with guest space or apps in guest space, 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.
httpsAgentObjectThis parameter is available only in Node.js environment.
The custom HTTPS agent to be used when request.
The agent should be compatible with https.Agent.
clientCertAuthObjectThis parameter is available only in Node.js environment.
When httpsAgent parameter is given, this parameter is unavailable.
If your Kintone environment uses Client Certificate authentication, please specify the certificate file and password.
clientCertAuth.pfxBufferThe client certificate file. Required, unless you specify pfxFilePath.
clientCertAuth.pfxFilePathStringThe path to client certificate file. Required, unless you specify pfx.
clientCertAuth.passwordStringThe password of client certificate.
proxyObject or falseThis parameter is available only in Node.js environment.
If you use a proxy, please specify its configuration.
To disable proxy and ignore proxy environment variables, please specify false.
proxy.protocolStringThe protocol of the proxy server. Default is http.
proxy.hostStringThe host of the proxy server.
proxy.portNumberThe port of the proxy server.
proxy.authObjectIf the proxy server requires Basic authentication, please specify its username and password.
proxy.auth.usernameStringThe username of Basic authentication for the proxy server.
proxy.auth.passwordStringThe password of Basic authentication for the proxy server.
userAgentStringThis parameter is available only in Node.js environment.
A User-Agent HTTP header
featureFlagsObjectFeature flags that you can configure. See Feature flags.
socketTimeoutNumberThis parameter is available only in Node.js environment.
The socket timeout in milliseconds.

Authentication

The client supports three authentication methods:

  1. Password authentication
  2. API token authentication
  3. OAuth authentication
  4. Session 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
usernameStringYes
passwordStringYes
2. Parameters for API token authentication
NameTypeRequiredDescription
apiTokenString or String[]YesYou can pass multiple api tokens as an array of string.
3. Parameters for OAuth authentication
NameTypeRequiredDescription
oAuthTokenStringYesAn OAuth access token you get through the OAuth process flow.
4. Session authentication

Supported in browser environment only. If you omit auth parameter, the client uses Session authentication.

Session authentication is available in Garoon customization.

Feature flags

NameTypeDefaultDescription
enableAbortSearchErrorbooleanfalseAn option of whether to throw KintoneAbortSearchError or not.

Error Handling

See Error Handling

TypeScript

See TypeScript Definitions

References

Contribution Guide

License

Keywords

FAQs

Package last updated on 27 Mar 2024

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