0
votes

I am working on intelliJ plugin to create check-in policy: I need to know how many check-in policies are applied on particular branch. I am using TFS JAVA SDK for retrieving the check-in policy configuration. But it is returning empty. Please refer my another issue at "PolicyDefinition result return empty collection using Java SDK of TFS 2015 "tp.getCheckinPolicies()" or "vcc.getCheckinPoliciesForServerPaths()""

Then I tried using REST API to understand if I can get policy definition using REST URL.

Constructing URL as given below as per example available on Microsoft blog “https://www.visualstudio.com/en-us/docs/integrate/api/policy/configurations”:

GET https://{instance}/defaultcollection/{project}/_apis/policy/configurations?api-version={version}[&$top={top}&$skip={skip}]

My URL: https://TFSServer/tfs/PC1/CP/_apis/policy/configurations?api-version=2.0-preview

This return empty collection. {"count":0,"value":[]}

I have on premise TFS and it is configured with TFVC services not GIT.

I have following doubts:

  1. Does REST API is applicable for TFVC or it is only for GIT collection.
  2. How to query TFS server for check in policy using SOAP API.
  3. Need to know if TFS JAVA SDK consume the same REST API or SOAP APIs.
  4. What is wrong in my URL?
2

2 Answers

0
votes

Check-in policies and branch policies are totally different, unrelated things.

Check-in policies are for TFVC and only TFVC. Branch policies are for Git and only Git.

The API you're using is for branch policies.

As far as I recall, there's no API for check-in policies. This goes for both the old-style SOAP APIs and the new-style REST APIs.

0
votes

Java SDK you used in your previous case is correct, but it can only get check-in policies in Java based tools, such as Team Explorer Everywhere. You can't get the check-in policies that added in VS with Java SDK.