Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Using Flows
Unanswered

"When a HTTP request is received" trigger breaks with SharePoint

(0) ShareShare
ReportReport
Posted on by 5

I'm trying to build a Flow which populates a SharePoint List from a submitted web form using When a HTTP request is received.

 

The flow works fantastically until I add a SharePoint Create item trigger. Then, I immediately start getting a BadRequest error on the trigger with no other explanation. I've tried rebuilding from scratch but I get the error as soon I add the Create item action.

 

Do I need to add some kind of authentication to the request in order to use the SharePoint connection?

 

Any help would be much appreciated.

 

rrunnels_0-1605208342397.png

 

  • rrunnels Profile Picture
    5 on at
    Re: "When a HTTP request is received" trigger breaks with SharePoint

    I found the problem - it was an issue with jQuery in the calling code. For anyone interested:

    The $.ajax() function has a dataType property that I set to "json" thinking that it would automatically set the header's content-type, but it actually only sets the data type expected in the return. The default content-type is "application/x-www-form-urlencoded".

     

     

    $.ajax({ 
     type: "POST", 
     url: $(this).attr("action"), 
     dataType: "json", 
     data: json_obj, 
    })

     

     

    This worked at first, but made the properties very difficult to access in Power Automate, which should have been my first clue. Then, of course, adding a SharePoint or SQL Server connector caused the whole flow to fail with BadRequest.

    To solve the problem I added a contentType property set to "application/json" and converted the payload from a json object to a string:

     

     

    $.ajax({
     type: "POST",
     url: $(this).attr("action"),
     dataType: "json",
     contentType: "application/json; charset=utf-8", // Set the content-type
     data: JSON.stringify(json_obj), // Stringify the output
    })

     

     

     

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,670 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,011 Most Valuable Professional

Leaderboard

Featured topics

Restore a deleted flow