How to modify the http request header before calling kintone.api()?

Can you please tell me how to  modify the HTTP Request Header  before calling the kintone.api() ?

 

 kintone.api(kintone.api.url(’/k/v1/records.json’, true), ‘GET’, params).then(function (response) {
           }, function (error) {

         });

Hello annaylee,

When you execute API using kintone.api, the fixed value is added, so you can’t usually change the HTTP request header.

It might depend on what exactly you are changing in the HTTP request header, but if you want to, you need to execute requests by different methods.

Suppose you want to change it by the GET request. In that case, people usually use authentication, so you would need to add header information using the kintone.proxy.

If you want to change it by the API token, it might be something like the following:

var header = {
'X-Cybozu-API-Token' : '<Generated API token>'
};

kintone.proxy(
'https://< sub-domain >.kintone.com/k/v1/records.json?app=100',
'GET',
header,
{},
function(body, status, headers) {
console.log(JSON.parse(body));
},
function(error) {
console.log(error);
}
);