I am attempting to run a WIQL query by sending the query in the Send HTTP Request to Azure DevOps as outlined in this issue https://powerusers.microsoft.com/t5/Power-Automate-Community-Blog/Create-Update-Parameterized-Queries-in-Azure-DevOps-with/ba-p/306106
However, when I attempt to send the query with a POST, I get the result "You must pass a query object in the body of the request." I do have a query in the body of the request. Does a WIQL query have to exist in Azure DevOps in order to call it? According to the screenshots in the link above, the relative uri is "{project}/_apis/wit/queries/My Queries/{Name of Query in JSON Body of request}?api-version=5.0". My relative uri is "{project}/_apis/wit/wiql?api-version=5.0". I have tried switching to the "queries/My Queries" uri as in the screenshot in the linked issue but I get the error "the query does not exist or you do not have permissions for it". The query doesn't exist, I am attempting to run it but from the screenshots in the link, it appears they are pointing to the My Queries of Azure and I would assume his query must be there or would get the same resulting error as I did? I have switched between api versions 5.0 & 5.1 and get the same error. Switching to 6.0 gets me an Unauthorized error. I have also switched between a POST and GET with the same error and when I try using PATCH as in the screenshots in the link, I get
TF400813: The user '27313870-5aa3-6c6c-a627-e8384e26de1a' is not authorized to access this resource.
Here is screenshot of my Send HTTP request to Azure DevOps:
Do I need to pass authentication like a PAT token in the headers? What am I missing here to get this HTTP call with a WIQL query to work? Thanks so much for any assistance. It is greatly appreciated.
Hi Mark,
Per Wiql - Query By Wiql - REST API (Azure DevOps Work Item Tracking) | Microsoft Docs
You should be able to send a generated WIQL call using:
POST https://dev.azure.com/fabrikam/_apis/wit/wiql?api-version=5.0
Body:
{
"query": "Select [System.Id], [System.Title], [System.State] From WorkItems Where [System.WorkItemType] = 'Task' AND [State] <> 'Closed' AND [State] <> 'Removed' order by [Microsoft.VSTS.Common.Priority] asc, [System.CreatedDate] desc"
}
This way you could create and store the queries in Power Automate since it looks like you're looking to dynamically update them anyway.
-Red
DBO_DV
25
Super User 2025 Season 1
Michael E. Gernaey
10
Super User 2025 Season 1
CU09051456-0
8