microsoftgraph / microsoftgraph/msgraph-sdk-php
Configuring Graph Requests and using Response Getters
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- PHP
- Estrellas
- 669
- Forks
- 150
- Merge medio
- 15 h 21 min
- PR fusionados (30 d)
- 3
Descripción
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": "Martin@jobcop.co.uk",
"id": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"displayName": "Martin Thorburn"
}
},
"owner": {
"user": {
"email": "Martin@jobcop.co.uk",
"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?
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza revisando los ejemplos de request-builder del PHP SDK para los endpoints /me/drive/root/children y /drives/{id}, junto con la documentación de los objetos de respuesta. Documenta cómo se asignan las rutas de los endpoints HTTP a las llamadas PHP y cómo inspeccionar los campos devueltos y los datos anidados. Se considera completado cuando la guía cubra tanto la traducción de requests como el acceso a las respuestas, con ejemplos que coincidan con las consultas reportadas.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- php
- Área
- documentation
- Tipo de issue
- Documentación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Estancado
- Claridad
- Necesita aclaración
- Aptitud para principiantes
- 25/100