Quick Start

bear.png
parrot.png
Get data from a record in four easy steps!
Get a Kintone subdomain
 
Prepare the
App
 
Generate an
API token
 
Retrieve the
data
 

Introduction

The Kintone REST API enables Records, Apps and Spaces to be controlled from external services.
This article introduces how to use curl to run the Get Record API from a command line tool, to retrieve record data from a Kintone App.

 

Step 1. Get a Kintone subdomain

A Kintone subdomain is necessary for testing out customizations and integrations involving Kintone. A free one-year Kintone developer license is available for members who join the Kintone Developer Program. Refer to the Get a Developer License page for information on how to apply for a free Kintone developer license. Return to this article when the developer license has been acquired.

Alternatively, you can sign up for a free trial environment from the Kintone website.

Step 2. Prepare a Kintone App

Before retrieving data from a Kintone record, a Kintone App and at least one record needs to be created. Log into the Kintone subdomain with the credentials provided with sign up, and follow these instructions to prepare an App.

  1. In the portal, click the [+] icon of the Apps widget, select Customer Service from the left menu, find the Customer Database App and click on Add This App. Confirm the prompt, to successfully add a Customer Database App into your Kintone environment.
    createapp.gif
  2. In the portal, click on the Customer Database App, located in the Apps widget. If there is no data in the App yet, the record list will be empty. Click on the [+] icon to start adding data into a new record. Clicking on Save will successfully add the new record into the App.
    createcrecord.gif

Step 3. Generate an API token and prepare the request parameters

This step prepares the necessary information to call a REST API request, by preparing the necessary request parameters, and generating an API token from the Kintone App.

1. Confirm the App ID and record ID

The API document for the Get Record API states that an App ID and a Record ID  needs to be included in the request. To confirm these parameters, navigate to the record details page.

The App ID and record ID are shown in the URL as follows:

For example, the App ID of the following Kintone subdomain called sampledomain is 42, and the record ID is 8.

2. Confirm the request URL

The API document for the Get Record API states that the request URI for the REST API call is in the format of:

Therefore, for a Kintone subdomain called sampledomain, the URL to send the request to would be:

Add the request parameters from the previous step to form the final request URI, in the following format:

Combining the examples used so far, the request URI for this example would be:

3. Generate an API token

There are three different types of authentication that can be used for the Kintone REST API: password authentication, API token authentication, and session authentication. For more details of these authentication types, refer to the Authentication section of the Kintone REST API Overview page. This example will use API token authentication.

To generate an API token from the App, first navigate to the Customer Database App created in the previous step. From any page within the App that was created in step 2 of this tutorial, click on the gear icon located in the top right corner of the App to access the settings of the App. Navigate to the App Settings tab, and click on API Token. Generate a new token, click Save, and click on Update App.
apitoken.gif

*Note that the Update App button must be clicked for the API Token to be useable with the App.

Step 4. Retrieve the data

The following information should now have been prepared:

  • An App ID and a record ID
  • A request URL
  • An API token

With this information, assemble the curl command to retrieve the record data as follows. As noted in the Get Record API document, the X-Cybozu-API-Token header is used when authenticating with an API token.

For example, retrieving the data of record 8 in App 42, with an API token of DjsLvFiyqwDTDxJJSXnNiAuGARpPMnUIYzFluegQ, in the subdomain sampledomain, would use the following command.

Running this command will result in the command line tool responding with the data of the specified record in JSON format.

The first property of the response is record. The properties within the record property are the fields that exist in the record in no particular order. As an example, the key value pairs "company_name":{"type":"SINGLE_LINE_TEXT","value":"Joshua's Burger Joint"} shows that the field with the field code company_name is a Text field with a value of "Joshua's Burger Joint".

Finally

In four easy steps, the Kintone REST API was used to retrieve record data from a Kintone App using curl. This data can now be used for various integrations with other services. There are many other APIs for Kintone Apps, such as APIs for adding new records, or updating existing records. Refer to the Kintone REST API Overview for more details on how to use the Kintone REST API, including other types of authentication, request headers, and limitations.

Was this article helpful?
2 out of 2 found this helpful
Do you have any questions or issues related to this article?
Please share your views with us in the Community forums!