import requests
from requests.auth import HTTPBasicAuth
# Configuration
organization = "your_organization"
project = "your_project"
work_item_id = "your_work_item_id"
personal_access_token = "your_personal_access_token"
# API endpoint for work item updates
url = f"https://dev.azure.com/{organization}/{project}/_apis/wit/workitems/{work_item_id}/updates?api-version=7.0"
# Send GET request
response = requests.get(url, auth=HTTPBasicAuth('', personal_access_token))
if response.status_code == 200:
updates = response.json()["value"]
for update in updates:
# Check if 'System.State' field is in the changed fields
if "System.State" in update.get("fields", {}):
print("Update ID:", update["id"])
print("Modified By:", update["revisedBy"]["displayName"])
print("Date:", update["revisedDate"])
print("Old State:", update["fields"]["System.State"]["oldValue"])
print("New State:", update["fields"]["System.State"]["newValue"])
print("-------------------------------------------------")
else:
print("Error:", response.status_code)
From Blogger iPhone client