Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Configuring Graph Requests and using Response Getters

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

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

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tài liệu
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
php
Lĩnh vực
documentation

Hướng nghiên cứu

Bắt đầu bằng cách xem lại các ví dụ request-builder của PHP SDK cho các endpoint /me/drive/root/children và /drives/{id}, cùng với tài liệu về các đối tượng response. Ghi lại cách ánh xạ các đường dẫn endpoint HTTP sang các lệnh gọi PHP và cách kiểm tra các trường được trả về cũng như dữ liệu lồng nhau. Công việc được xem là hoàn tất khi hướng dẫn bao quát cả việc chuyển đổi request và truy cập response, với các ví dụ khớp với các truy vấn đã được báo cáo.

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

Mô tả

type:question

Hi much of the PHP SDK documentation refers to HTTP requests like
https://graph.microsoft.com/v1.0/me/drive/root/children

However when I try to translate this to a Graph query
$result = $graphServiceClient->users()->byUserId("my-user-id")->drive()->root()->children()->get()->wait();

or
$result = $graphServiceClient->users()->byUserId("my-user-id")->drive()->root()->children()->post()->wait();
The SDK tells me root() and children() are not part of the drive request builder.

Is there documentation that shows how to translate HTTP examples like "https://graph.microsoft.com/v1.0/me/drive/root/children" into their PHP equivalent? Or, even better, documentation that shows each of the endpoints for PHP SDK?

Lastly does the PHP SDK, provide a response getter and/or getter for every data field returned from the server? Again, the documentation gives HTTP request examples with JSON response examples,

{
     "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives/$entity",
     "@microsoft.graph.tips": "Use $select to choose only the properties your app needs, as this can lead to performance improvements. For example: GET me/drive?$select=driveType,owner",
     "createdDateTime": "2023-10-22T00:11:21Z",
     "description": "",
     "id": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
     "lastModifiedDateTime": "2024-06-27T10:39:41Z",
     "name": "OneDrive",
     "webUrl": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Documents",
     "driveType": "business",
     "createdBy": {
         "user": {
             "displayName": "System Account"
         }
     },
     "lastModifiedBy": {
         "user": {
             "email": "[email protected]",
             "id": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
             "displayName": "Martin Thorburn"
         }
     },
     "owner": {
         "user": {
             "email": "[email protected]",
             "id": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
             "displayName": "Martin Thorburn"
         }
     },
     "quota": {
         "deleted": 1030849340,
         "remaining": 1097450601323,
         "state": "normal",
         "total": 1099511627776,
         "used": 1030177113
     }
 }

however, if I use a query like:
$result = $graphServiceClient->drives()->byDriveId('my-drive-id')->get()->wait();

I do not seem to get anything like the documentated json response. Indeed if I use
print_r($result);

all I get is a huge, unformatted object !!

Is there a reponse getter, i.e.
$result->getResponse();

or
$result->getbody();

How would I even try to read the response, or even know what getters to use to access the retuted data ?

I woould really appreciate some help and guidance on this?

Ngôn ngữ chính
PHP
Star
669
Fork
150
Merge trung bình
15 giờ 21 phút
Pull request đã merge (30 ngày)
3

Chuẩn bị môi trường

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.

Issue khác của microsoftgraph/msgraph-sdk-php

Tất cả issue của microsoftgraph/msgraph-sdk-php

Issue tương tự

Thêm issue về PHP

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.