0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

kintoneのアプリをトークン使って更新するサンプル

Last updated at Posted at 2025-09-15

まあどれだけ需要があるかわかりませんが、今回ちょっと必要だったので備忘録で


                    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);




0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?