Kintone REST API Request
The Kintone REST API Request enables running Kintone REST APIs from JavaScript code.
Relying solely on the JavaScript API has limitations. For example, retrieving data from all records within an App requires the use of the Kintone REST API.
To perform this action, use the Kintone REST API request to run the REST API.
It is not necessary to specify request headers when using this API.
Kintone REST API Request - kintone.api()
REST APIs with the GET
, POST
, PUT
, DELETE
method can be used.
Function
kintone.api(pathOrUrl, method, params, successCallback, failureCallback)
Request Parameters
PARAMETER | VALUE | REQUIRED | DESCRIPTION |
---|---|---|---|
pathOrUrl | String | Yes | The path of the Kintone REST API, or the URL obtained with kintone.api.url .If the URL of the API is https://{subdomain}.kintone.com/k/v1/xxx.json , then specify the parameter as /k/v1/xxx.json . If the app is to be used inside a guest space, specify the parameter as kintone.api.url("/k/v1/xxx.json", true) . |
method | String | Yes | The HTTP method. Specify one of the following: GET / POST / PUT / DELETE . |
params | Object | Yes | The parameters to be used with the API, specified as an object. |
successCallback | Function | Optional | The callback function called when the API succeeds. The parameter for this function is an object. If ignored, a kintone.Promise object will be returned that can be fulfilled with the parameter passed to the callback. |
failureCallback | Function | Optional | The callback function called when the API fails. The parameter for this function is a JSON response. If the JSON response cannot be parsed, an unparsed string will be given. If the callback is ignored, a kintone.Promise object will be returned that can be rejected with the parameter passed to the failureCallback . |
Returns
A kintone.Promise
object will be returned if the successCallback
or failureCallback
parameters are ignored. Otherwise, there will be no response.
Sample Request
|
|
Sample Request Using Promises
|
|
Limitations
The following Kintone REST APIs cannot be run.
To execute from a customization applied to the App, use the browser's Fetch API or XMLHttpRequest.
Notes
When a GET
request is sent using kintone.api()
, and the length exceeds 4KB, the X-HTTP-Method-Override header will automatically be added and the request will be sent as a POST
request.
For more information, refer to the following article:
X-HTTP-Method-Override