400 Bad Request when trying to retrieve information about a specific build configuration .

Im trying to use a script coded in ruby language to interact with TeamCity server to retrieve some information about a specific build configuration and check if there are any pinned builds associated with a particular tag. But I got this error when using my code with a tag that has a parenthesis (this is the tag im using "tag123(PR)"): Failed to retrieve build information. Status code: 400 Response body: Responding with error, status code: 400 (Bad Request). Details: jetbrains.buildServer.server.rest.errors.LocatorProcessException: Bad locator syntax: Invalid dimension name :'tag123'. Should contain only alpha-numeric symbols or be known one: [name, private, owner, start, count, lookupLimit, $reportErrorOnNothingFound, $contextItem]. Details: locator: 'tag123(PR)', at position 0 Invalid request. Check locator is specified correctly. On the other hand , it worked correctly when testing with a tag that did not have parenthesis . I also tried to encode the tag before using it to conform to the URLS format using this(URI.encode_www_form_component), because URLs have specific rules for encoding characters, and parentheses are not allowed as-is in a URL without encoding. but i still got the same error above. So i would like to know if there is a way to resolve this error. For more information , my Teamcity version is 2018.1 Thank in advance

0
2 comments

Hello,

Please try one of the following requests:

/app/rest/builds?locator=tag:((tag123(PR)))
/app/rest/builds?locator=tag:(name:(tag123(PR)))

Wrapping the value with round brackets into more round brackets helps to parse that value correctly, rather than as a nested locator dimension.

1

Thank you for your quick response, it worked perfectly.

0

Please sign in to leave a comment.