Azure Invoke REST Services with VSTS - azure-devops

As I was working on DevOps Integration with mendix for CI/CD Pipeline creation Using Mendix API (Team Server API, Build API, Deploy API).
With this pipeline I have been using Invoke Rest Services task Invoke HTTP REST API task - Azure Pipelines | Microsoft Docs ,Implement a Simple CICD Pipeline with Mendix APIs | Mendix Documentation these are two documents which I have been referred.
I have created Pipelines for that I have added two invoke REST task.
With the below screenshot, in the GET service I could able to get the revision number and all I need to do is dynamically pass in the POST method to the Revision number attribute which was highlighted.
Kindly provide a solution on the below issues.
Thanks in advance!
Get Method for Team Server API for mendix
Post Method for Build API for mendix

Related

Integrating Service Now with Azure Devops

i am trying to have an integration between service now and azure devops .
If any one can answer below question it be much appreciated.
How to trigger Azure DevOps pipeline automatically on Approving the Change Request in ServiceNow ?
I am approaching with rest API method to call AzureDevops from servicenow plateform.
Does anyone has done something similar and can help me here by listing steps to do so?
You need to create a Service Connection to you ServiceNow instance and then add a Gate in your Release pipeline which creates the Change Request in ServiceNow and then waits for it's status to change.
This provides a good guide - https://learn.microsoft.com/en-us/azure/devops/pipelines/release/approvals/servicenow?view=azure-devops and your gate will end up looking something like this:
You can also use an existing CR but then you'll need a way to supply that to the pipeline on creation of the release.
In the azure devops, we can Install and configure ServiceNow DevOps extension for Azure DevOps to send build and release notifications from your Azure pipeline to ServiceNow DevOps application.
For more details, you can refer this doc: Azure DevOps integration with DevOps

How can I trigger an update of Azure DevOps pipeline agent major version by script?

I am trying to automate the update of major version on self-hosted agent, by script. I have searched the docs for Azure DevOps REST API to achive this but no luck. I found a solution online that requires you to reinstall the agent on every machine, which is not what I am after. Anyone have a clue? Is there a way to achieve this through the REST API?
Is there a way to achieve this through the REST API?
The answer is yes.
We could use the REST API Agents - Update to update the version of the agent.
PATCH https://dev.azure.com/{organization}/_apis/distributedtask/pools/{poolId}/agents/{agentId}?api-version=5.1
We do not provide the request body for this REST API.
To get the poolId, we could use the REST API Pools - Get Agent Pools:
GET https://dev.azure.com/{organization}/_apis/distributedtask/pools?api-version=5.1
As the result:

Call a release build from REST api in Azure

I want to call the Azure Devops to create a new release from one of my Release Pipelines.
I have been looking for different calls but its either to create the pipeline or build artifacts.
Is there a way to call a release pipeline from Azure API?
I did it with the next endpoint: https://learn.microsoft.com/en-us/rest/api/azure/devops/build/Builds/Queue?view=azure-devops-rest-5.0&viewFallbackFrom=vsts-rest-4.1
I was using a wrong body for the endpoint. With the example from the documentation it worked.

How to create new build pipeline using Azure DevOps REST API?

I'm trying to create new build pipeline through programmatically. I'm looking for Azure DevOps REST API for this action. I didn't get the proper examples for creating the pipeline using REST API.
Please advise.
How to create new build pipeline using Azure DevOps REST API?
To create the new build pipeline, we could use the REST API Definitions - Create:
POST https://dev.azure.com/{organization}/{project}/_apis/build/definitions?api-version=5.0
But we need provide too much information in the Request Body, this will be a big project and error-prone. That also the reason why the document not provide a sample Request Body there.
To resolve this issue, usually we would use the REST API Definitions - Get to get the Response Body from the template pipeline:
GET https://dev.azure.com/{organization}/{project}/_apis/build/definitions/{definitionId}?api-version=5.0
Then we just need to update the corresponding properties by modifying the Response Body.
Now, we get the new Request Body for the new pipeline, we could use it with REST API Definitions - Create to create a new pipeline.
You could check this thread for some more details.
Update:
After creating the build definition, Will it create
azure-pipelines.yml file and store in the repository like Azure Repos?
No, if you want to create a YAML type build definition using the rest api, it will not create the corresponding yaml file to our repo, because this API Definitions - Create only send the request body to the pipeline does not operate our repo. Currently, it support creating a build definition that links to a YAML file within the Git repo. If you want to create the yaml automatically, you could check the REST API Pushes - Create.
This should be where the REST API Definitions - Create needs to be improved to support the YAML pipeline. You could add your request for this feature on our UserVoice site (https://developercommunity.visualstudio.com/content/idea/post.html?space=21 ), which is our main forum for product suggestions. Thank you for helping us build a better Azure DevOps:
Hope this helps.

How to integrate ServiceNow custom application with Azure Devops using REST API

How can i establish connection to service now custom application through Azure Devops.
When release happens through Devops,how can i close service now custom application tickets automatically.
How to integrate ServiceNow custom application with Azure Devops using REST API
We could integrate them through REST API:
REST API Overview for Visual Studio Team Services and Team Foundation Server
ServiceNow REST API
There is a great article about integrating them:
Integrate ServiceNow with VSTS RM pipelines using PowerShell
Hope this helps.