Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have an Azure logic app that uses a "Send HTTP request" block to send a REST API call to VSTS to create an incident. The call fails with "HTTP Error 400. The request hostname is invalid.".

I tried the same request from Postman and the request succeeded. To make sure that I am making the same request I copied the URI, the headers, the body from the logic app.

How can I further investigate what is going on? Is there a log in VSTS where I can find out more info. Any help, any suggestion is highly appreciated.

Here you have the code of the "HTTP request block"

{
"inputs": {
    "method": "POST",
    "uri": "https://dev.azure.com/<your-vsts-organization>/<your-vsts-project>/_apis/wit/workitems/$Incident?api-version=4.1",
    "headers": {
        "Authorization": "Basic .................................",
        "Content-Type": "application/json-patch+json"
    },
    "body": "[
    {
    "op": "add",
    "path": "/fields/System.Description",
    "from": null,
    "value": "@{body('Parse_JSON_2')['Description']}"
  },
  {
    "op": "add",
    "path": "/fields/System.Title",
    "from": null,
    "value": "@{body('Parse_JSON_2')['Title']}"
  },
  {
    "op": "add",
    "path": "/fields/System.IterationPath",
    "from": null,
    "value": "<your-iteration-path>"
  },
  {
    "op": "add",
    "path": "/fields/System.AreaPath",
    "from": null,
    "value": "<your-area-path>"
  },
  {
    "op": "add",
    "path": "/fields/Microsoft.VSTS.Common.Priority",
    "from": null,
    "value": "2"
  },
  {
    "op": "add",
    "path": "/fields/Microsoft.VSTS.Common.Severity",
    "from": null,
    "value": "2 - High"
  },
  {
    "op": "add",
    "path": "/fields/Microsoft.VSTS.CMMI.HowFound",
    "from": null,
    "value": "Azure Monitoring Alert"
  },
]"
}

}

Here you have a screenshot of the request block:

enter image description here

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
161 views
Welcome To Ask or Share your Answers For Others

1 Answer

We could easily do that with Azure Logic App - Azure DevOps connector.

I do a demo for creating an Azure DevOps workitem.

The following is the detail steps:

1.Create a logic App and send an http request to Azure DevOps action

enter image description here

2.Connect to Azure Devops and add the related information, for information please refer to the screenshot.

enter image description here

  1. Test it on my side

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...