Skip to main content

Notifications

Community site session details

Community site session details

Session Id : AvpetOnY8zWEujq6OXbiGH
Power Automate - Using Connectors
Unanswered

Sending WIQL query in Send HTTP Request to Azure DevOps error

Like (0) ShareShare
ReportReport
Posted on 18 Nov 2021 21:55:19 by

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:

MarkBarrett67_0-1637272403974.png

 

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.

 

  • Red Hodgerson Profile Picture
    Microsoft Employee on 29 Dec 2021 at 23:31:13
    Re: Sending WIQL query in Send HTTP Request to Azure DevOps error

    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

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,660 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,004 Most Valuable Professional

Leaderboard

Featured topics

Loading started
Loading complete