[REST] Getting a list of jobs that contain specific resulting properties

Answered

I'm trying to get from the server, via REST, all run jobs that contain a specific parameter, and I want it to only return those properties as a result.
I have this working with one property like so, and works well.

https://<server>/app/rest/buildTypes/id:<projectName>/builds/?locator=branch:default:any,status:SUCCESS,property:(name:<propertyName>)&fields=build(number,status,resultingProperties($locator(name:(<propertyName>)),property))

However, I'm not sure of the syntax I should be using to filter and return two or more properties, I've tried a number of things, but most yields errors along the lines of you can only use name: or resultingProperies once.
What's the correct way to do this, and is there an even easier way than the above?

2 comments
Comment actions Permalink

Ok, I have it working now using regex, thanks to this post https://teamcity-support.jetbrains.com/hc/en-us/community/posts/360005655960-How-to-get-filtered-resulting-properties-with-REST-API- however, it wasn't clear to me how the regex syntax worked.

 

$locator(name:(value:(<regexp>),matchType:matches))

 

When the penny dropped, I realised value here meant the value for the name attribute, and as I was dealing with resultingProperties which has name and value attributes which caused confusion my side.

Is there any place where this is documented?

 

 

0
Comment actions Permalink

Sorry for the delay. Unfortunately this syntax is not documented, but it's hard to make a single syntax work for URL-based parameters that enables this kind of approach. It has been considered experimental for a rather long time, and it's more or less stable by now but still not documented on our end since it's still open to change.

 

In general, for a given field, you can typically pass "$help" and while you will receive a 400 answer, it will actually parse it as an explicit request for help and it will have a short display of information. This will typically just indicate the values available for that specific field, but might be useful going forward.

0

Please sign in to leave a comment.