✨
Azure DevOps WebAPI
やりたいこと
WorkItemsの取得
- Wiql:
- Work Items:
Pull Requestの取得
#公式サンプル
#公式WebAPI
WorkItemsの取得
Python
import requests
import base64
import config
authorization = str(base64.b64encode(bytes(':'+ config.personal_access_token, 'ascii')), 'ascii')
headers = {
'Accept': 'application/json',
'Authorization': 'Basic '+authorization
}
ids='200,201,202'
response = requests.get(
url=f'https://dev.azure.com/{config.organization}/{config.project}/_apis/wit/workitems?ids={ids}&api-version=7.0&$expand=all', headers=headers)
print(response.text)
import requests
import base64
import config
contents = {
"query": "Select [System.Id], [System.Title], [System.State] " \
"From WorkItems " \
"Where [System.WorkItemType] = 'Task' AND [State] <> 'Closed' AND [State] <> 'Removed' " \
"order by [Microsoft.VSTS.Common.Priority] asc, [System.CreatedDate] desc"
}
url=f'https://dev.azure.com/{config.organization}/{config.project}/_apis/wit/wiql?api-version=7.0&$top=9999'
authorization = str(base64.b64encode(bytes(':'+ config.personal_access_token, 'ascii')), 'ascii')
headers = {
'Accept': 'application/json',
'Authorization': 'Basic '+authorization
}
response = requests.post(url=url, headers=headers, json=contents)
print(response.text)
Discussion