Bulk Request

 

Introduction

The Bulk Request API allows multiple API requests to run on multiple kintone apps. The below API can be used with the Bulk Request API

  • Add Record
  • Add Records
  • Update Record
  • Update Records
  • Delete Records
  • Update Status
  • Update Statuses
  • Update Assignees

Bulk RequestPOST /bulkRequest.json

Runs multiple API requests to multiple apps in one go.

URI

https://{subdomain}.kintone.com/k/v1/bulkRequest.json

URI for Guest Space Apps

https://{subdomain}.kintone.com/k/guest/{spaceID}/v1/bulkRequest.json

Request Parameters

PARAMETER VALUE REQUIRED DESCRIPTION
requests Array Yes The multiple requests. The maximum number of requests is 20.
requests[].method String Yes The API method.
requests[].api String Yes The path of the API.
For apps in guest spaces, use /k/guest/{guestspaceID}/{command}.json.
requests[].payload   Yes The parameters to be passed onto the API.
Contents and formats will change depending on the API.

Sample Request

Request Header

POST /k/v1/bulkRequest.json HTTP/1.1
Host: kintonedemo.kintone.com:443
X-Cybozu-Authorization: a2ludG9uZTpkZXZlbG9wZXI=
Content-Type: application/json

Body

{
	"requests": [
		{
			"method": "POST",
			"api": "/k/v1/record.json",
			"payload": {
				"app":1690,
				"record": {
					"Single_line_text": {
						"value": "New text"
					}
				}
			}
		},
		{
			"method": "PUT",
			"api": "/k/v1/record.json",
			"payload": {
				"app": 1690,
				"id": 33,
				"revision": -1,
				"record": {
					"Single_line_text": {
						"value": "Updated text"
					}
				}
			}
		},
		{
			"method": "DELETE",
			"api": "/k/v1/records.json",
			"payload": {
				"app": 1974,
				"ids": [
				10,
				11
				],
				"revisions": [
				1,
				1
				]
			}
		}
	]
}

Response

An array is responded, where the results are placed into the same index as the request.

PARAMETER VALUE DESCRIPTION
results Array The response from each API request. The order of the response is the same as the order of the requests.

Successful Response

{
    "results": [
        {
            "id": "39",
            "revision": "1"
        },
        {
            "revision": "34"
        },
        {}
    ]
}

Failed Response

This is a sample failed response, where the second PUT request fails due to a record ID not existing. If an API fails, the error will be placed in that index, and the following APIs will not be run, and will respond with {} (empty objects).

{
	"results": [
		{},
		{
			"message": "Record(id:33)NotFound.",
			"id": "1505999166-1721668264",
			"code": "GAIA_RE01"
		},
		{}
	]
}

Limitations

  • The maximum number of requests is 20.
  • If one of the API requests fail, all operations will roll back.
  • The Bulk Request API used for guest space apps can only target apps within the same guest space.
  • If an API token is used for authentication, only 1 API token can be used with this API (i.e. the Bulk Request can only target one app).
Was this article helpful?
0 out of 0 found this helpful
Comments
Please sign in to leave a comment.