Compute changeset difference between two releases using API's
Below are the steps which can be followed to compute changeset difference between two releases for TFVC project
===========================================================================================
Step1: Get details of the primary build artifact for the current release using build API. Store 'sourceVersion' say as 'currentReleaseBuildVersion'
https://{account}.visualstudio.com/{project}/_apis/build/builds/{buildId}
e.g. https://testking123.visualstudio.com/3a607d2a-d6c9-4274-9d13-d83c544d5063/_apis/build/builds/2348
Step2: Get details of the primary build artifact for the older release. Store 'sourceVersion' say as 'baseReleaseBuildVersion'
Step3: Make sure as build definition for both the builds in Step#1 and Step#2 are same
Step4: Get the build definition details for above builds using API to get 'tfvcMapping' for further filtering
https://{account}.visualstudio.com/{project}/_apis/build/Definitions/{definitionId}
Step5: Make TFVC API to find the difference using API
https://{account}.visualstudio.com/{project}/_apis/tfvc/changesets?searchCriteria.fromId=<baseReleaseBuildVersion>&searchCriteria.toId=<currentReleaseBuildVersion>&searchCriteria.itemPath=<item path as got in step#3 to filter further>
e.g.
https://testking123.visualstudio.com/3a607d2a-d6c9-4274-9d13-d83c544d5063/_apis/tfvc/changesets?searchCriteria.fromId=282&searchCriteria.toId=284
Step6: Done!!!!
Below are the steps which can be followed to compute changeset difference between two releases for TFGIT project
============================================================================================
Step1: Get details of the primary build artifact for the current release using build API. Store 'sourceVersion' say as 'currentReleaseBuildVersion'
https://{account}.visualstudio.com/{project}/_apis/build/builds/{buildId}
e.g. https://testking123.visualstudio.com/3a607d2a-d6c9-4274-9d13-d83c544d5063/_apis/build/builds/2348
Step2: Get details of the primary build artifact for the older release. Store 'sourceVersion' say as 'baseReleaseBuildVersion'
Step3: Make sure as build definition and repositoryId for both the builds in Step#1 and Step#2 are same. Store ''repository.Id' say as repositoryId.
Step4: Make POST call using TFGIT API to find the difference using API
https://{account}.visualstudio.com/{project}/_apis/git/repositories/{repository}/commitsBatch?api-version=1.0
Request body: {"itemVersion":{"versionType":"commit","version":"fromCommitGUIDHere"},"compareVersion":{"versionType":"commit","version":"toCommitGUIDHere"}}
e.g. https://testking123.visualstudio.com/3a607d2a-d6c9-4274-9d13-d83c544d5063/_apis/git/repositories/278d5cd2-584d-4b63-824a-2ba458937249/commitsBatch?api-version=1.0
Request body: {"itemVersion":{"versionType":"commit","version":"currentReleaseBuildVersion"},"compareVersion":{"versionType":"commit","version":"baseReleaseBuildVersion"}}
Step5: Done