Capability Sources

Prepare an upload to OneDrive or SharePoint, or a replacement of an existing file's content, for a client with a shell

Changed on

Prepare a Microsoft upload session for an explicitly requested upload. This does not upload bytes or prove completion. With itemId and baseRevision the upload replaces that file's content as a new version; otherwise it creates name in folderId (or the top of the drive). Do not automatically create another session after an uncertain result. Uses the selected connection.

post/v1/capabilities/microsoft-365/drive-upload-sessions

Request

  • Base URL: https://api.openworklabs.com
  • URL: https://api.openworklabs.com/v1/capabilities/microsoft-365/drive-upload-sessions
  • Auth: one of:
    • API key in header x-api-key
    • HTTP bearer

Request body

driveIdstring

The file's driveId from a search, folder or link result. Omit for the member's own OneDrive.

itemIdstring

Replace this existing file's content. It keeps its link and sharing; the previous version stays in its version history.

baseRevisionstring

Required with itemId: the eTag your copy was downloaded from. Refused with drive_conflict when the file changed since; download it again and reapply the edits, or save a new file.

folderIdstring

New files only: the folder to create the file in; omit for the top of the drive.

namestring

New files only: the file name.

conflictBehavior'fail' | 'rename'

New files only: fail, or let Microsoft rename the file when the name is taken.

sizeinteger required

Exact file size in bytes.

Response

Secret upload session; file not yet uploaded.

oktrue required
uploadUrlstring uri required

Secret bearer upload-session URL. Never print, share, persist or log it, and never send an Authorization header to it.

method'PUT' required
sizeinteger required
chunkSize10485760 required
expiresAtstring date-time nullable required
instructionsstring required

Changes

    • breaking

      the response property / became nullable for the status

    • breaking

      the response property / became nullable for the status

    • breaking

      the response property / became nullable for the status

    • info

      response property anyOf[InvalidRequestError]/details/items/path/items/ list-of-types was narrowed by removing types number from media type application/json of response 400

    • info

      response property anyOf[subschema #2]/currentRevision list-of-types was narrowed by removing types null from media type application/json of response 409

    • info

      response property anyOf[subschema #2]/modifiedTime list-of-types was narrowed by removing types null from media type application/json of response 409

    • info

      response property replaces/previousRevision list-of-types was narrowed by removing types null from media type application/json of response 200

    • info

      the / response's property pattern was changed from ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$ to ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$ for the status

    • info

      endpoint added