Pages - Create Or Update

Creates or edits a wiki page.

PUT https://dev.azure.com/{organization}/{project}/_apis/wiki/wikis/{wikiIdentifier}/pages?path={path}&api-version=7.1
PUT https://dev.azure.com/{organization}/{project}/_apis/wiki/wikis/{wikiIdentifier}/pages?path={path}&comment={comment}&versionDescriptor.version={versionDescriptor.version}&versionDescriptor.versionOptions={versionDescriptor.versionOptions}&versionDescriptor.versionType={versionDescriptor.versionType}&api-version=7.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' to use this version of the api.

path
query True

string

Wiki page path.

comment
query

string

Comment to be associated with the page operation.

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 Header

Name Required Type Description
Version True

string

Version of the page on which the change is to be made. Mandatory for Edit scenario. To be populated in the If-Match header of the request.

Request Body

Name Type Description
content

string

Content of the wiki page.

Responses

Name Type Description
200 OK

WikiPage

Page edited. Edited page's version is populated in the ETag response header.

Headers

ETag: string

201 Created

WikiPage

Page created. Created page'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

Add a page
Edit a page

Add a page

Sample request

PUT https://dev.azure.com/{organization}/{project}/_apis/wiki/wikis/{wikiIdentifier}/pages?path=SamplePage973&api-version=7.1

{
  "content": "Wiki page content"
}

Sample response

eTag: "4c6adda4736aae086c7ae1956da1d91aba09d6fb"
{
  "path": "/SamplePage973",
  "order": 1,
  "gitItemPath": "/SamplePage973.md",
  "subPages": [],
  "url": "https://dev.azure.com/fabrikam/e5e9e01e-801a-47eb-80bb-0ad24f448abe/_apis/wiki/wikis/ffa4628c-8f6d-45c0-b61b-52c16d06c925/pages/%2FSamplePage973",
  "remoteUrl": "https://dev.azure.com/fabrikam/e5e9e01e-801a-47eb-80bb-0ad24f448abe/_wiki/wikis/ffa4628c-8f6d-45c0-b61b-52c16d06c925?pagePath=%2FSamplePage973",
  "id": 51,
  "content": "Wiki page content"
}

Edit a page

Sample request

PUT https://dev.azure.com/{organization}/{project}/_apis/wiki/wikis/{wikiIdentifier}/pages?path=/SamplePage973&api-version=7.1

{
  "content": "New content for page"
}

Sample response

eTag: "c14ea53eb6fc5921c184be18c6b3d2d916548f28"
{
  "path": "/SamplePage973",
  "order": 1,
  "isParentPage": true,
  "gitItemPath": "/SamplePage973.md",
  "subPages": [],
  "url": "https://dev.azure.com/fabrikam/e5e9e01e-801a-47eb-80bb-0ad24f448abe/_apis/wiki/wikis/ffa4628c-8f6d-45c0-b61b-52c16d06c925/pages/%2FSamplePage973",
  "remoteUrl": "https://dev.azure.com/fabrikam/e5e9e01e-801a-47eb-80bb-0ad24f448abe/_wiki/wikis/ffa4628c-8f6d-45c0-b61b-52c16d06c925?pagePath=%2FSamplePage973",
  "id": 51,
  "content": "New content for page"
}

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

WikiPage

Defines a page in a wiki.

WikiPageCreateOrUpdateParameters

Contract encapsulating parameters for the page create or update operations.

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

WikiPage

Defines a page in a wiki.

Name Type Description
content

string

Content of the wiki page.

gitItemPath

string

Path of the git item corresponding to the wiki page stored in the backing Git repository.

id

integer

When present, permanent identifier for the wiki page

isNonConformant

boolean

True if a page is non-conforming, i.e. 1) if the name doesn't match page naming standards. 2) if the page does not have a valid entry in the appropriate order file.

isParentPage

boolean

True if this page has subpages under its path.

order

integer

Order of the wiki page, relative to other pages in the same hierarchy level.

path

string

Path of the wiki page.

remoteUrl

string

Remote web url to the wiki page.

subPages

WikiPage[]

List of subpages of the current page.

url

string

REST url for this wiki page.

WikiPageCreateOrUpdateParameters

Contract encapsulating parameters for the page create or update operations.

Name Type Description
content

string

Content of the wiki page.