【发布时间】:2020-11-05 21:43:09
【问题描述】:
我正在使用 python 请求库将迭代路径传递给 REST API 查询中的字段。
>>> payload = {"name": "Audit Work Items","wiql": ("SELECT [System.Id],[System.WorkItemType],[System.Title],[System.AssignedTo],[System.State],[System.Tags],[System.IterationPath] FROM workitems WHERE [System.WorkItemType] = 'User Story' OR [System.WorkItemType] = 'Bug' AND [System.IterationPath] = '\2CES\Backlog\2020\20.1\20.1.5' ORDER BY [System.Id]")}
>>> response = requests.post(organization_url, auth=HTTPBasicAuth(username, password), verify=False, json=payload)
>>> response.text
'{"$id":"1","innerException":null,"message":"TF51011: The specified iteration path does not exist. The error is caused by «\'\\u0002CES\\\\Backlog\x820\\u0010.1\\u0010.1.5\'».","typeName":"Microsoft.TeamFoundation.WorkItemTracking.Client.Wiql.SyntaxException, Microsoft.TeamFoundation.WorkItemTracking.Client.QueryLanguage","typeKey":"SyntaxException","errorCode":0,"eventId":0}'
>>>
我无法理解 REST API 返回的 innerException 以及为什么路径会在错误消息中显示一些二进制字符?
谁能帮我解决这个问题,提前谢谢。
【问题讨论】:
-
您是否尝试转义反斜杠字符?
标签: python-3.x tfs azure-devops python-requests azure-devops-rest-api