I tried using commits rest api but it's listing the entire commit instead of the expected ones.
Used API like this: https://dev.azure.com/xxx/xxxx/_apis/git/repositories/xxxxx/commits?api-version=7.0&searchCriteria.fromCommitId={fromcommit}&searchCriteria.toCommitId={tocommit}
In order to get the list of commits between two commits, it is better to use
searchCriteria.fromDate={searchCriteria.fromDate}&searchCriteria.toDate={searchCriteria.toDate}
. It will provide you the commits as per the created date.If you intend to use
searchCriteria.fromCommitId={searchCriteria.fromCommitId}&searchCriteria.toCommitId={searchCriteria.toCommitId}
, then it will provide you results either in alphabetical order if commit Ids are started with letters likea*****1 to g*****0
or in numerical order if commit Ids are started with numbers like0*****321 to 5******g23
.I am using the below URL-
I am getting the expected results as shown below-
References-
Rest-api-to-get-all-commit-info-between-base and target commit.