How to write content and fetch that content from Azure Wiki by using Python Script?
I used Azure wiki API for making connections but I don't know how to fetch the content from there.
And API is: GET https://dev.azure.com/{organization}/{project}/_apis/wiki/wikis/{wikiIdentifier}?api-version=6.0
CodePudding user response:
Based on your requirement, you need to use Rest API to get the content from Wiki.
I suggest that you can use Rest API: Pages - Get
For example:
GET https://dev.azure.com/fabrikam/{project}/_apis/wiki/wikis/{wikiIdentifier}/pages?path=/SamplePage129&includeContent=True&api-version=5.0
Use Python to run the Rest API:
import requests
import base64
pat = 'PAT'
authorization = str(base64.b64encode(bytes(':' pat, 'ascii')), 'ascii')
headers = {
'Accept': 'application/json',
'Authorization': 'Basic ' authorization
}
response = requests.get(
url="https://dev.azure.com/fabrikam/{project}/_apis/wiki/wikis/{wikiIdentifier}/pages?path=/SamplePage129&includeContent=True&api-version=5.0", headers=headers)
print(response)