REST API Build Locator: Build number with hyphen

Completed

I'm trying to use the REST API to look up a build by build number, but I think I'm having problems because the build number contains a hyphen: 1.0.0-3, for example.

 

I want to do something like this:

TEAMCITY_URL/httpAuth/app/rest/builds?locator=status:SUCCESS,buildType:MyBuildType,branch:name:feature/myFeature,number:1.0.0-3&fields=count,build(href,number,pinned,tags)

Everything works great until I try to add the build number to the locator. Any suggestions?

Edit: Actually, in this case the build number might also contain a "+", in addition to the "-".

3 comments
Comment actions Permalink

You need to URL encode the +, so for example if your build number is 1.0.0+3 then try 1.0.0%2B3.

1
Comment actions Permalink

Thanks Dylan Munyard, but that still is not working.

Tried encoding just the "+" as %2B, just the "-" as "%2D", and both together. Same result each time:

<builds count="0"/>

0
Comment actions Permalink

Must have fat-fingered something. Dylan Munyard, that was indeed the problem. As you said, the "-" works fine as is, but the "=" needs to be encoded as a %2B.

 

Thanks!

1

Please sign in to leave a comment.