Kintone REST API Request
The Kintone REST API Request allows you to run Kintone REST APIs from your JavaScript code.
You'll find that you are limited to several actions when just completely relying on the JavaScript API - for example, you'll need to use the Kintone REST API if you need to retrieve data of all the records inside your app.
This is where you will 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
File upload/downloads cannot be run. You will need to retrieve the CSRF token, and run an HTTP request.
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