REST Api - Vcs root instances - incorrect results

Hi

Using teamcity enterprise 2018.2

I've noticed commit hooks aren't triggering for everything, with 1 example I can see the commit hook is using:

app/rest/vcs-root-instances/commitHookNotification?locator=property:(name:url,value:${project.key}/${repository.slug}.git,matchType:contains,ignoreCase:true)  

if I look at the results of rest api:

app/rest/vcs-root-instances?locator=vcsRoot:(type:jetbrains.git,property:(name:url,value:%internalGitPath%,matchType:equals))

it returns 65 - which isn't right

looking at documentation, to find more results I've used the below:

app/rest/vcs-root-instances?locator=vcsRoot:(type:jetbrains.git,property:(name:url,value:%internalGitPath%,matchType:equals),count:99999),count:99999

returns 70 results with the vcs root instance that isn't being triggered on commit hook

 

The REST API documentation states that it'll return the first 100 results, but if first result set is only 65, then why is it not returning the other 5 results like the 2nd REST call above?

 

both calls to REST api show below in the logs:

 

20584 items were processed and 100 items were returned, took 1041 ms

 

however, 100 items weren't returned

 

Am I missing something here?

 

0
1 comment

Hi Karl,

 

you are facing this issue: https://youtrack.jetbrains.com/issue/TW-46698. As you yourself have checked, the "count" parameter would fix the issue. You can add it to your locator in your commit hook and that should to the trick.

 

Count works a bit counter-intuitively here. It returns all the values but strips out those that do not match, without altering their position on the returned list. That means that if your instance 67 is in position 123, it will not show up in the list with the first 100. This is a current limitation on how our REST API works, I'm afraid.

 

Hope this helps.

0

Please sign in to leave a comment.