microsoftgraph / microsoftgraph/msgraph-sdk-java

InvalidRequest: Missing header Client-Request-Id. Header Client-Request-Id is not a guid

オープン
#2,164 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Needs: Attention :wave: type:legacy-version type:question
主要言語
Java
スター
444
フォーク
154
平均マージ
18時間 28分
マージ済み PR(30日)
4

説明

Graph API End point:
POST https://graph.microsoft.com/v1.0/drive/items/{item-id}/workbook/comments

Request Body:

{
  "content": "This is a sample text"
}

I am passing GUID in the Client-Request-Id but still the issue remains same.

When posting comments to a word document using graph Client getting
Error message: {"code":"InvalidRequest","message":"Missing header Client-Request-Id. Header Client-Request-Id is not a guid.","innerError":{"request-id":"00000000-0000-0000-0000-000000000000","date":"2024-09-20T17:03:58.6112675-07:00"}}

I tried using GraphExplorer,JavaCode(Refer Below),JavaScriptClient and everywhere the issue remains same.


import java.util.UUID;

import org.apache.hc.client5.http.classic.methods.HttpPost;
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse;
import org.apache.hc.client5.http.impl.classic.HttpClients;
import org.apache.hc.core5.http.io.entity.EntityUtils;
import org.apache.hc.core5.http.io.entity.StringEntity;

public class AddComment {
    public static void main(String[] args) {
        try {
            String url = "https://graph.microsoft.com/v1.0/sites/" + "my-site-id" + "/drives/" + "my-drive-id" + "/items/" + "item-id" + "/workbook/comments";

            String clientRequestId = UUID.randomUUID().toString(); // Generate a new GUID
 
            CloseableHttpClient client = HttpClients.createDefault();
            HttpPost post = new HttpPost(url);

            post.setHeader("Authorization", "Bearer access-token");
            post.setHeader("client-Request-Id", clientRequestId);
            post.setHeader("Content-Type", "application/json");
            String json = "{\"content\": \"MS Document Comment\"}";
            StringEntity entity = new StringEntity(json);
            post.setEntity(entity);

            CloseableHttpResponse response = client.execute(post);
            String responseBody = EntityUtils.toString(response.getEntity());
            System.out.println(response.getCode());
            System.out.println(responseBody);

            client.close();
            // Handle the response...

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、AddComment の例にある workbook/comments エンドポイントへの POST リクエストを、Client-Request-Id ヘッダーを含めて再現し、Graph Explorer と JavaScript クライアントが送信するリクエストを比較します。Java SDK が GUID ヘッダーを変更または削除しているのか、それとも拒否が Graph API 自体に起因するのかを特定できれば完了です。レポートではリポジトリのファイルやテストを指定しません。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
api
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。