Attachments - Create

Creates an attachment in the wiki.

PUT https://dev.azure.com/{organization}/{project}/_apis/wiki/wikis/{wikiIdentifier}/attachments?name={name}&api-version=7.1-preview.1
PUT https://dev.azure.com/{organization}/{project}/_apis/wiki/wikis/{wikiIdentifier}/attachments?name={name}&versionDescriptor.version={versionDescriptor.version}&versionDescriptor.versionOptions={versionDescriptor.versionOptions}&versionDescriptor.versionType={versionDescriptor.versionType}&api-version=7.1-preview.1

URI Parameters

Name In Required Type Description
organization
path True

string

The name of the Azure DevOps organization.

project
path True

string

Project ID or project name

wikiIdentifier
path True

string

Wiki ID or wiki name.

api-version
query True

string

Version of the API to use. This should be set to '7.1-preview.1' to use this version of the api.

name
query True

string

Wiki attachment name.

versionDescriptor.version
query

string

Version string identifier (name of tag/branch, SHA1 of commit)

versionDescriptor.versionOptions
query

GitVersionOptions

Version options - Specify additional modifiers to version (e.g Previous)

versionDescriptor.versionType
query

GitVersionType

Version type (branch, tag, or commit). Determines how Id is interpreted

Request Body

Media Types: "application/octet-stream"

Name Type Description
body

string

Stream to upload

Responses

Name Type Description
201 Created

WikiAttachment

Attachment created. Attachment's version is populated in the ETag response header.

Headers

ETag: string

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.wiki_write Grants the ability to read, create and updates wikis, wiki pages and wiki attachments.

Examples

Sample Request

PUT https://dev.azure.com/fabrikam/{project}/_apis/wiki/wikis/{wikiIdentifier}/attachments?api-version=7.1-preview.1

Sample Response

eTag: "7926b6f6fc8e1ebf392df6093f4508890a06a9d1"
{
  "name": "Attachment845.png",
  "path": "/.attachments/Attachment845.png"
}

Definitions

Name Description
GitVersionOptions

Version options - Specify additional modifiers to version (e.g Previous)

GitVersionType

Version type (branch, tag, or commit). Determines how Id is interpreted

WikiAttachment

Defines properties for wiki attachment file.

GitVersionOptions

Version options - Specify additional modifiers to version (e.g Previous)

Name Type Description
firstParent

string

First parent of commit (HEAD^)

none

string

Not specified

previousChange

string

Commit that changed item prior to the current version

GitVersionType

Version type (branch, tag, or commit). Determines how Id is interpreted

Name Type Description
branch

string

Interpret the version as a branch name

commit

string

Interpret the version as a commit ID (SHA1)

tag

string

Interpret the version as a tag name

WikiAttachment

Defines properties for wiki attachment file.

Name Type Description
name

string

Name of the wiki attachment file.

path

string

Path of the wiki attachment file.