REST API Get test details by test name


I have a question about getting test details. If my test name contains comma or # symbols api returns The remote server returned an error: (400) Bad Request.

My query is:

http://tsbuild-app/guestAuth/app/rest/testOccurrences?locator=build:(id:xxxx),test:(name:<Test name with , or\and # symbols>)&fields=testOccurrence(test(xxxx))

I have tried to escape those symbols using powershell:

$encodedTeamcityTestName = [convert]::ToString($teamcityTestName).Replace( ',' , '%2с' );
$encodedTeamcityTestName = $encodedTeamcityTestName.Replace( '#' , '%23' )
$Url = "http://tsbuild-app/guestAuth/app/rest/testOccurrences?locator=build:(id:$BuildId),test:(name:$encodedTeamcityTestName)&fields=testOccurrence(test(id))"

This helped to get around the error, but did not return the result. How to build correct GET url?

Comment actions Permalink

Hi, sorry for the delay.

If you have names with special characters, you need to follow the indications here:

Can you test whether that works for you?

Comment actions Permalink

Hello. No answer?

Comment actions Permalink

Thank you so much! :)


Please sign in to leave a comment.