How do I incorporate brackets in a buildLocator when using the REST API?

I am attempting to create a powershell script that automatically pins every 10th build a config performs.  Our build number contains brackets and I am struggling to construct the http POST so that teamcity accepts it.  For example:

TeamCityServer.co.uk/httpAuth/app/rest/builds/buildType:(id:bt493,number:%7Bbuild.number%7D-(12))

Where the build configs id is "bt493" and the build number is "{build.number}-(12)".  I realise that looks like an odd build number, it is replaced by something else later in the build process.  Currently I get back:

Error has occurred during request processing (Bad Request).
Error: jetbrains.buildServer.server.rest.errors.LocatorProcessException: Bad locator syntax: No dimensions delimiter , after complex value. Details: locator: 'buildType:(id:bt493,number:{build.number}-(12))', at position 46
Invalid request. Check locator is specified correctly.


Any ideas?

Please sign in to leave a comment.