Skip to content

Commit 7fb96d4

Browse files
authored
Merge pull request #38 from opencloud-eu/feat/download-url
feat: Add @microsoft.graph.downloadUrl annotation and /content endpoi…
2 parents ea2b760 + b2dd276 commit 7fb96d4

1 file changed

Lines changed: 86 additions & 0 deletions

File tree

api/openapi-spec/v1.0.yaml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,6 +1206,7 @@ paths:
12061206
type: string
12071207
example: a0ca6a90-a365-4782-871e-d44447bbc668$a0ca6a90-a365-4782-871e-d44447bbc668!share-id
12081208
x-ms-docs-key-type: item
1209+
- $ref: '#/components/parameters/driveItemSelect'
12091210
responses:
12101211
"200":
12111212
description: Retrieved driveItem
@@ -1309,6 +1310,64 @@ paths:
13091310
default:
13101311
$ref: '#/components/responses/error'
13111312
x-ms-docs-operation-type: operation
1313+
'/v1beta1/drives/{drive-id}/items/{item-id}/content':
1314+
get:
1315+
tags:
1316+
- driveItem
1317+
summary: Download the content of a DriveItem
1318+
operationId: GetDriveItemContent
1319+
description: |
1320+
Download the contents of the primary stream (file) of a driveItem. Only
1321+
driveItem objects with a `file` facet can be downloaded.
1322+
1323+
The response is a `302 Found` redirecting to a pre-authenticated download
1324+
URL for the file. This is the same URL that is returned via the
1325+
`@microsoft.graph.downloadUrl` instance annotation on the driveItem when
1326+
requested via `$select`. Choose between the two based on whether you
1327+
want to call the redirecting `/content` endpoint directly (for example,
1328+
with a client that follows redirects automatically) or you want to
1329+
inspect / schedule / prefetch the URL yourself via the annotation.
1330+
1331+
The pre-authenticated URL is short-lived and does not require an
1332+
`Authorization` header.
1333+
1334+
To download a partial range of bytes, apply the `Range` header to the
1335+
redirect target (the pre-authenticated URL), not to the `/content`
1336+
request.
1337+
parameters:
1338+
- name: drive-id
1339+
in: path
1340+
description: 'key: id of drive'
1341+
required: true
1342+
schema:
1343+
type: string
1344+
x-ms-docs-key-type: drive
1345+
- name: item-id
1346+
in: path
1347+
description: 'key: id of item'
1348+
required: true
1349+
schema:
1350+
type: string
1351+
x-ms-docs-key-type: item
1352+
responses:
1353+
'302':
1354+
description: Pre-authenticated redirect to the file content.
1355+
headers:
1356+
Location:
1357+
required: true
1358+
schema:
1359+
type: string
1360+
format: uri
1361+
description: The pre-authenticated URL where the content can be downloaded.
1362+
'404':
1363+
description: The driveItem was not found or is not a file.
1364+
content:
1365+
application/json:
1366+
schema:
1367+
$ref: '#/components/schemas/odata.error'
1368+
default:
1369+
$ref: '#/components/responses/error'
1370+
x-ms-docs-operation-type: operation
13121371
'/v1beta1/drives/{drive-id}/items/{item-id}/createLink':
13131372
post:
13141373
tags:
@@ -4917,6 +4976,16 @@ components:
49174976
'@client.synchronize':
49184977
description: Indicates if the item is synchronized with the underlying storage provider. Read-only.
49194978
type: boolean
4979+
'@microsoft.graph.downloadUrl':
4980+
description: |
4981+
A pre-authenticated URL that can be used to download the item's content without
4982+
providing an Authorization header. The URL is short-lived and cannot be cached.
4983+
4984+
This annotation is only populated when explicitly requested via `$select`, and
4985+
only for items that have a `file` facet. The returned URL is valid for a
4986+
limited time and should be used promptly.
4987+
type: string
4988+
readOnly: true
49204989
# follows the SAP UI vocabulary: https://github.com/SAP/odata-vocabularies/blob/main/vocabularies/UI.md
49214990
'@UI.Hidden':
49224991
description: Properties or facets (see UI.Facet) annotated with this term will not be rendered if the annotation evaluates to true. Users can set this to hide permissions.
@@ -5915,6 +5984,23 @@ components:
59155984
description: Search items by search phrases
59165985
schema:
59175986
type: string
5987+
driveItemSelect:
5988+
name: $select
5989+
in: query
5990+
description: Select additional properties to be returned.
5991+
style: form
5992+
explode: false
5993+
schema:
5994+
uniqueItems: true
5995+
type: array
5996+
items:
5997+
enum:
5998+
- '@microsoft.graph.downloadUrl'
5999+
type: string
6000+
examples:
6001+
request download url:
6002+
value:
6003+
- '@microsoft.graph.downloadUrl'
59186004
drivesFilter:
59196005
name: $filter
59206006
in: query

0 commit comments

Comments
 (0)