ユーザーの部分更新のリクエスト時に出るuserExternalKey must be the same as the primary organization\'s externalKey.の対処法を教えてほしい。

c7f137

2023.09.11既読 69

■この話は
ユーザーの部分更新のリクエスト時に出る以下エラーについて
userExternalKey must be the same as the primary organization\'s externalKey.
■前提
userExternalKeyは使っていない。
tokenは間違ってない。
■結論
なぜこのエラーになるのかわかる方いらっしゃれば教えてほしいです。
function update_user_org(){
  let token = getToken();//トークンを取得する関数
  let response;
  let userId = "example@example.co.jp";
  let headers = {
    "Authorization": "Bearer " + token,
    "Content-Type": "application/json",
  };

  let payload = {
      "organizations": [
        {
          "domainId": 10000001,
          "primary": true,
          "orgUnits": [
            {
              "orgUnitId": "orgUnitIdを入れる",
              "primary": true,
            }
          ]
        }
      ],
    }

 
  let options =
  {
    "method" : "patch",
    "headers" : headers,
    "payload" : JSON.stringify(payload),
  };

  response = UrlFetchApp.fetch("https://www.worksapis.com/v1.0/users/"+ userId, options);
  console.log(JSON.parse(response));
  return JSON.parse(response);

}

コメント0

前の投稿 AppLinkで他ユーザーのトークを開く処理について
次の投稿検索をかけた状態のトークルームを表示したい
リスト

まだ、解決できませんか?
今すぐ実際に使用しているLINE WORKSユーザーに質問してみましょう。