owncloud / ocis

:atom_symbol: ownCloud Infinite Scale Stack
https://doc.owncloud.com/ocis/next/
Apache License 2.0
1.4k stars 182 forks source link

[Graph API] [v1beta1] Missing media props in GET request for drive item #9521

Open grgprarup opened 4 months ago

grgprarup commented 4 months ago

Describe the bug

There is an endpoint in graph API v1beta1 documented in Swagger (https://owncloud.dev/libre-graph-api/#/driveItem/GetDriveItem)

Get a DriveItem by using its ID
GET /v1beta1/drives/{drive-id}/items/{item-id}

when requested to that endpoint, the media props (audio, image, location, photo) are not returned in the response, which only works with items in the Shares space when the share receiver sends a request.

But, when requested to v1.0 endpoint GET /v1.0/drives/{drive-id}/items/{item-id}, the media props (audio, image) are returned in the response, and the v1.0 endpoint is not documented in Swagger. It works for both items in the Shares space (requested by the share receiver) and items in the Personal space (requested by the owner).

Expected behavior

  1. Return the media props in GET request response for v1beta1
  2. Add the Swagger API documentation for v1.0

Actual behavior

v1beta1

When requested by share receiver

curl -kv -XGET -ueinstein:relativity https://localhost:9200/graph/v1beta1/drives/a0ca6a90-a365-4782-871e-d44447bbc668\$a0ca6a90-a365-4782-871e-d44447bbc668/items/a0ca6a90-a365-4782-871e-d44447bbc668\$a0ca6a90-a365-4782-871e-d44447bbc668\!ce7c53b7-fc9d-400d-a158-988bd2871bd2:d93288fb-0141-413c-bbbe-36509d3d58c3:dc0514c5-8d3f-42bf-9d55-b1f6d4fa8447
Response: HTTP 200 ``` { "@UI.Hidden": false, "@client.synchronize": true, "createdBy": { "user": { "displayName": "Admin", "id": "d93288fb-0141-413c-bbbe-36509d3d58c3" } }, "eTag": "\"00dad127797a329cb076bd1a23e089ad\"", "file": { "mimeType": "audio/mpeg" }, "id": "a0ca6a90-a365-4782-871e-d44447bbc668$a0ca6a90-a365-4782-871e-d44447bbc668!ce7c53b7-fc9d-400d-a158-988bd2871bd2:d93288fb-0141-413c-bbbe-36509d3d58c3:dc0514c5-8d3f-42bf-9d55-b1f6d4fa8447", "lastModifiedDateTime": "2023-03-24T20:29:30.000000204+05:45", "name": "testimage.mp3", "parentReference": { "driveId": "a0ca6a90-a365-4782-871e-d44447bbc668$a0ca6a90-a365-4782-871e-d44447bbc668", "driveType": "virtual", "id": "a0ca6a90-a365-4782-871e-d44447bbc668$a0ca6a90-a365-4782-871e-d44447bbc668!a0ca6a90-a365-4782-871e-d44447bbc668" }, "remoteItem": { "createdBy": { "user": { "displayName": "Admin", "id": "d93288fb-0141-413c-bbbe-36509d3d58c3" } }, "eTag": "\"00dad127797a329cb076bd1a23e089ad\"", "file": { "mimeType": "audio/mpeg" }, "id": "ce7c53b7-fc9d-400d-a158-988bd2871bd2$d93288fb-0141-413c-bbbe-36509d3d58c3!832955ea-612d-4821-abd6-c8f5c06f503e", "lastModifiedDateTime": "2023-03-24T20:29:30.000000204+05:45", "name": "testimage.mp3", "parentReference": { "driveId": "ce7c53b7-fc9d-400d-a158-988bd2871bd2$d93288fb-0141-413c-bbbe-36509d3d58c3!d93288fb-0141-413c-bbbe-36509d3d58c3", "driveType": "personal" }, "permissions": [ { "createdDateTime": "2024-07-03T15:14:44.371155797+05:45", "grantedToV2": { "user": { "displayName": "Albert Einstein", "id": "4c510ada-c86b-4815-8820-42cdf82c3d51" } }, "id": "ce7c53b7-fc9d-400d-a158-988bd2871bd2:d93288fb-0141-413c-bbbe-36509d3d58c3:dc0514c5-8d3f-42bf-9d55-b1f6d4fa8447", "invitation": { "invitedBy": { "user": { "displayName": "Admin", "id": "d93288fb-0141-413c-bbbe-36509d3d58c3" } } }, "roles": [ "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5" ] } ], "size": 6144 }, "size": 6144 } ```

When requested by Owner

curl -kv -XGET -uadmin:admin https://localhost:9200/graph/v1beta1/drives/ce7c53b7-fc9d-400d-a158-988bd2871bd2\$d93288fb-0141-413c-bbbe-36509d3d58c3/items/ce7c53b7-fc9d-400d-a158-988bd2871bd2\$d93288fb-0141-413c-bbbe-36509d3d58c3\!832955ea-612d-4821-abd6-c8f5c06f503e

Response: HTTP 400

{"error":{"code":"invalidRequest","innererror":{"date":"2024-07-03T10:09:33Z","message":"id does not belong to a share jail"}}

v1.0

When requested by share receiver

curl -kv -XGET -ueinstein:relativity https://localhost:9200/graph/v1.0/drives/a0ca6a90-a365-4782-871e-d44447bbc668\$a0ca6a90-a365-4782-871e-d44447bbc668/items/a0ca6a90-a365-4782-871e-d44447bbc668\$a0ca6a90-a365-4782-871e-d44447bbc668\!ce7c53b7-fc9d-400d-a158-988bd2871bd2:d93288fb-0141-413c-bbbe-36509d3d58c3:dc0514c5-8d3f-42bf-9d55-b1f6d4fa8447
Response: HTTP 200 ``` { "audio": { "album": "ALBUM1234567890123456789012345", "artist": "ARTIST123456789012345678901234", "genre": "Pop", "title": "TITLE1234567890123456789012345", "track": 1, "year": 2001 }, "eTag": "\"00dad127797a329cb076bd1a23e089ad\"", "file": { "mimeType": "audio/mpeg" }, "id": "ce7c53b7-fc9d-400d-a158-988bd2871bd2$d93288fb-0141-413c-bbbe-36509d3d58c3!832955ea-612d-4821-abd6-c8f5c06f503e", "lastModifiedDateTime": "2023-03-24T20:29:30.000000204+05:45", "name": "testimage.mp3", "parentReference": { "driveId": "ce7c53b7-fc9d-400d-a158-988bd2871bd2$d93288fb-0141-413c-bbbe-36509d3d58c3", "driveType": "personal", "id": "ce7c53b7-fc9d-400d-a158-988bd2871bd2$d93288fb-0141-413c-bbbe-36509d3d58c3!d93288fb-0141-413c-bbbe-36509d3d58c3", "name": ".", "path": "." }, "size": 6144 } ```

When requested by Owner

curl -kv -XGET -uadmin:admin https://localhost:9200/graph/v1.0/drives/ce7c53b7-fc9d-400d-a158-988bd2871bd2\$d93288fb-0141-413c-bbbe-36509d3d58c3/items/ce7c53b7-fc9d-400d-a158-988bd2871bd2\$d93288fb-0141-413c-bbbe-36509d3d58c3\!832955ea-612d-4821-abd6-c8f5c06f503e
Response: HTTP 200 ``` { "audio": { "album": "ALBUM1234567890123456789012345", "artist": "ARTIST123456789012345678901234", "genre": "Pop", "title": "TITLE1234567890123456789012345", "track": 1, "year": 2001 }, "eTag": "\"00dad127797a329cb076bd1a23e089ad\"", "file": { "mimeType": "audio/mpeg" }, "id": "ce7c53b7-fc9d-400d-a158-988bd2871bd2$d93288fb-0141-413c-bbbe-36509d3d58c3!832955ea-612d-4821-abd6-c8f5c06f503e", "lastModifiedDateTime": "2023-03-24T20:29:30.000000204+05:45", "name": "testimage.mp3", "parentReference": { "driveId": "ce7c53b7-fc9d-400d-a158-988bd2871bd2$d93288fb-0141-413c-bbbe-36509d3d58c3", "driveType": "personal", "id": "ce7c53b7-fc9d-400d-a158-988bd2871bd2$d93288fb-0141-413c-bbbe-36509d3d58c3!d93288fb-0141-413c-bbbe-36509d3d58c3", "name": "/", "path": "/" }, "size": 6144 } ```

Setup

```console OCIS= Infinite Scale 6.0.0+0453e240f Community (ocis-rolling master) WEB = ownCloud Web UI 9.1.0-alpha.1 Tika Service Enabled ```

saw-jan commented 4 months ago

CC @micbar @rhafer