Get changes associated with a build in Azure Devops using REST API - rest

In Azure Devops under the "Summary" tab associated with a build, there are a list of changes (Git hashes, etc.) associated with the build. I'm trying to figure out how to get these via the rest API.
I found this REST API to get the changes between the two builds.
It works if I have the previous build id in the pipeline, however in the situation I'm interested in, I have the current build id, I need to somehow use the REST API to find the previous id.
Is there a way to do this using the REST API, or a better way to accomplish what I'm trying to do here?

As far as I can see, there's a special REST API call for that. You pass the buildId as a part of the URL and get the collection of changes (Change[]) in response.

Related

Is it possible to retrieve build definition ID related to a work item using Azure DevOps REST API?

The requirement is to fetch all the work items between different releases and create a report. The list of work items can be fetched using below API call.
https://vsrm.dev.azure.com/{organizationName}/{projectName}/_apis/release/releases/{currentReleaseId}/workitems??api-version=6.0&baseReleaseId={baseReleaseId}
Now, for each of this work item, we also need to know the build version when it is delivered. I'm not able to find any entries related to build/release in the work item data fetched using
https://dev.azure.com/{organizationName}/_apis/wit/workItems/{ID}
Is there any relationship between work item tasks and respective build or release definition ID when it was delivered?
Is it possible to retrieve build definition ID related to a work item using Azure DevOps REST API?
The answer is yes.
You could use the REST API Work Items - Get Work Item with $expand to get the commit links:
Get https://dev.azure.com/{org name}/{project name}/_apis/wit/workitems/{id}?$expand=relations&api-version=6.0
Then you would see the commits in relations part of the response body:
Then we could use the REST API Statuses API for Commit. It seems that when starting and ending build, the appropriate status is posted.
So when we call
GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/commits/{commitId}/statuses?api-version=6.0
We will get all last builds associated with the Commit and their statuses.

Can You Get Project Startdate from Azure DevOps REST API?

I'm trying to query the Azure Devops REST API to see when a project first came into existence and, perhaps, who created it. I'm using the link below and my results do match the documentation which, unfortunately, doesn't include create date. Is there any other ways to query AzDo REST API to get this data?
https://learn.microsoft.com/en-us/rest/api/azure/devops/core/projects/get%20project%20properties?view=azure-devops-rest-5.1
I am afraid there is no rest api to get the start date of project. The start date property is not included in the returned results of Get Project Api.
This issue has been reported to Microsoft develop team. You can vote up this thread or submit a new feature(Click Suggest a feature and choose Azure Devops).

Jenkins REST API to get the changes related to a particular job

I need to get the changes of a particular job (not the build) through rest api.
I am able to get the changes relates to a build but unable to find the rest api to get the changes of a particular job.
I have used "http://jenkis_url:port/job/job_name/changes/api/json". This does not get display any useful data that I need but throws 404 error.
I can get changes of a build using the "http://jenkis_url:port/job/job_name/build_no/api/json".
Please suggest me the REST API to get the changes of a job.

Export of discussion notes from Azure DevOps

Is there a way to export discussion notes from Azure DevOps Work items like Task/Bug etc. Or is there a way in Azure DevOps to get a consolidated web view of discussion? Or can you suggest any extensions that help achieve this?
Checked Azure DevOps for getting the dump through query which did not work
Using the rest api below, you can get the comments records of multiple work items from the response body.
GET https://dev.azure.com/{organization}/{project}/_apis/wit/workitems?ids={ids}&api-version=5.1
But the flaw of this rest api is that it can't display all the comment records, only display the latest comment of this work item.
If you want to get all the comments of a work item, you need to use the rest api below. However, the drawback of this rest api is that it can only return all the comments of a work item, and cannot display the comments records of multiple work items.
GET https://dev.azure.com/{organization}/{project}/_apis/wit/workItems/{id}/comments?api-version=5.0-preview.2

VSTS Release API Documentation

In the following post uses the VSTS release API to get all the work items associated with a release: VSTS find workitems between two releases
It uses the following call:
https://{account}.vsrm.visualstudio.com/[teamproject]/_apis/Release/releases/{current release id}/workitems?api-version=4.1-preview.1&baseReleaseId={compare release id}
workitems isn't listed in the VSTS API documentation: https://learn.microsoft.com/en-us/rest/api/vsts/release/releases/get%20release?view=vsts-rest-4.1
Is there a more complete list available that I simply can't find? Is it possible to get the list of commits similar to:
Most of the REST APIs are documented here : Visual Studio Team Services REST API Reference
However some related REST APIs are not documented. For these REST APIs we can use tools such as Fiddler or directly press F12 - network in Chrome to track them.
Based on my test, no such a REST API can directly retrieve the compared commits from Release. Actually the different commits are retrieved by several REST APIs, get information from corresponding changesets then compare them...
So, if you want to get the different commits with REST API, you need to retrieve the changeset ID from previous release and the changeset ID in current release. then compare them.
e.g:
POST : https://{account}.visualstudio.com/{project}/_api/_versioncontrol/history?api-version=5.0-preview.1
Request Body:
{"repositoryId":"","searchCriteria":"{\"itemPaths\":[\"$/0522TFVCScrum/PS\"],\"fromVersion\":\"180\",\"toVersion\":\"183\",\"top\":50}"}