まあどれだけ需要があるかわかりませんが、今回ちょっと必要だったので備忘録で
const xhr = new XMLHttpRequest();
xhr.open(
"PUT",
"https://xxxFAKExxx.cybozu.com/k/v1/record.json"//自分のところで
);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader(
"X-Cybozu-API-Token",
"xxxxxxxxxxxxxxxxxxxxxxxxx" //更新先からトークンとってきてください
);
const param = JSON.stringify({
app: xx,//更新先のアプリid
id: xx,//更新先のアプリのレコードid
record: {
text1: {
value:"foo"
},
text2: {
value:"bar",
},
},
});
xhr.onload = () => {
if (xhr.readyState == 4 && xhr.status == 201) {
//成功時
} else {
console.log(xhr);
//失敗時
}
};
xhr.send(param);