1

I am passing the Iteration path to the field in REST API Query using python requests library.

>>> 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}'
>>>

I am unable to understand the innerException returned by the REST API and why is the path showing some binary characters in the error message ?

Can anyone please help me fix this issue, thanks in advance.

1
  • Did you try escaping the backslash character? Commented Jul 16, 2020 at 17:11

1 Answer 1

2

The backslashes need to be escaped. \2CES is being interpreted as a Unicode character. Try \\2CES

Sign up to request clarification or add additional context in comments.

1 Comment

The solution worked. I took an ID for a work item and executed it through requests GET call from python interpreter which returned the result set as dictionary. I found the System.IterationPath has been escaped with back slash in the response output.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.