Get URL with Query

Get URL with Query - kintone.api.urlForGet()

Returns a URL including a query string, from an API path and parameters.

Function

kintone.api.urlForGet(path, params,opt_detectGuestSpace)

Request Parameters

PARAMETER VALUE REQUIRED DESCRIPTION
path String Yes The Kintone REST API path string beginning with /.
If the URL of the API is https://{subdomain}.kintone.com/k/v1/xxx.json, then specify the parameter as /k/v1/xxx.
params Object Yes The parameters to be used with the API, specified as an object.
opt_detectGuestSpace Boolean Optional If this is set to true, and is used in a guest space app, the URI of the guest space will be returned. Default is false.

Returns

A URL string including a query string, with URL encoded parameters.

Sample Request

1
2
3
4
5
var urlForGet = kintone.api.urlForGet('/k/v1/records.json', {app: 7, fields: ['text_0']});
console.log(decodeURIComponent(urlForGet));

// returns
// https://{subdomain}.kintone.com/k/v1/records.json?app=7&fields[0]=text_0