REST API Get test details by test name Follow
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?
Please sign in to leave a comment.
Hi, sorry for the delay.
If you have names with special characters, you need to follow the indications here: https://confluence.jetbrains.com/display/TCD10/REST+API#RESTAPI-Locator
Can you test whether that works for you?
Hello. No answer?
Thank you so much! :)