Attachments - Upload Chunk

Uploads an attachment chunk.

Before performing Upload a Chunk, make sure to have an attachment id returned in Start a Chunked Upload example on Create section. Specify the byte range of the chunk using Content-Length. For example: "Content - Length": "bytes 0 - 39999 / 50000" for the first 40000 bytes of a 50000 byte file.

PUT https://dev.azure.com/{organization}/{project}/_apis/wit/attachments/{id}?api-version=6.0
PUT https://dev.azure.com/{organization}/{project}/_apis/wit/attachments/{id}?fileName={fileName}&api-version=6.0

URI Parameters

Name In Required Type Description
id
path True

string

uuid

The id of the attachment

organization
path True

string

The name of the Azure DevOps organization.

project
path

string

Project ID or project name

api-version
query True

string

Version of the API to use. This should be set to '6.0' to use this version of the api.

fileName
query

string

Request Header

Media Types: "application/octet-stream"

Name Required Type Description
contentRangeHeader True

string

starting and ending byte positions for chunked file upload, format is "Content-Range": "bytes 0-10000/50000"

Request Body

Media Types: "application/octet-stream"

Name Type Description
body

string

Stream to upload

Responses

Name Type Description
200 OK

AttachmentReference

successful operation

Security

oauth2

Type: oauth2
Flow: accessCode
Authorization URL: https://app.vssps.visualstudio.com/oauth2/authorize&response_type=Assertion
Token URL: https://app.vssps.visualstudio.com/oauth2/token?client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer&grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer

Scopes

Name Description
vso.work_write Grants the ability to read, create, and update work items and queries, update board metadata, read area and iterations paths other work item tracking related metadata, execute queries, and to receive notifications about work item events via service hooks.

Examples

Upload a Chunk

Sample Request

PUT https://dev.azure.com/fabrikam/_apis/wit/attachments/{id}?api-version=6.0

"[CHUNK CONTENT]"

Sample Response

{
  "id": "de471719-27b2-40ab-ac40-4890f3eb1443",
  "url": "https://dev.azure.com/fabrikam/_apis/wit/attachments/de471719-27b2-40ab-ac40-4890f3eb1443"
}

Definitions

AttachmentReference

Name Type Description
id

string

url

string