microsoftgraph / microsoftgraph/msgraph-sdk-java

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

Đang mở
#2,164 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Needs: Attention :wave: type:legacy-version type:question
Ngôn ngữ chính
Java
Star
444
Fork
154
Merge trung bình
18 giờ 28 phút
Pull request đã merge (30 ngày)
4

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện yêu cầu POST tới endpoint workbook/comments từ ví dụ AddComment, bao gồm header Client-Request-Id của yêu cầu, rồi so sánh yêu cầu được Graph Explorer và client JavaScript gửi đi. Công việc được xem là hoàn tất khi xác định được liệu Java SDK có thay đổi hoặc loại bỏ header GUID hay việc từ chối đến từ chính Graph API; báo cáo không nêu tên tệp nào trong repository hoặc test nào.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
java
Lĩnh vực
api
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.