How to get filtered resulting-properties with REST API?

Hi,

Is there a way to filter out the resulting-properties when querying the REST API so I only get back the ones I'm interested in?

I'm tried using /{buildLocator}/resolved/{value}, but it seems to simply return whatever I give it as value.

 

Thanks,
o

0
3 comments

Hi Ofer,

 

I'm not sure where that "resolved" comes from, but that's definitely not going to work. There is one way to filter resulting properties via the REST API, which is not really documented. Please keep in mind that this means that this might be subject to change in the future.

 

If you are looking into a single specific parameter, then you can use the following request:
app/rest/builds/<your locator>?fields=build(resultingProperties($locator(<parameter_name>))

If you need a set of values for each build, assuming you can create a regexp for it, you could try something like this:
app/rest/builds/<your locator>?fields=build(resultingProperties($locator(name:(value:(<regexp>),matchType:matches)),property))

 

The only parts that need to be replaced are the angle-bracketed ones. Every $ is important to tell the parser that what comes next is a special element. If the regexp won't work, the option would be to pick them up one by one via a script and join them on your own.

0

Hi Denis,

Thanks a lot for your answer! Your solution does the trick. Is there anywhere I can find all the options available for locators?

Thanks,
Ofer

0

Hi Ofer,

 

Our REST API docs show most of the common use cases: https://www.jetbrains.com/help/teamcity/rest-api.html

The full documentation is available via swagger for json: <your_server_url>/app/rest/swagger.json

And WADL for xml: <your_server_url>/app/rest/application.wadl

 

Most requests accept a "$help" parameter for the locator providing some further information on what is accepted for that endpoint, also sending an unsupported locator will display the same. Some specific requests as the one above are quite more complex and aren't going to be explicitly documented.

0

Please sign in to leave a comment.