web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Syntax for multipart/f...
Power Automate
Answered

Syntax for multipart/form-data in HTTP POST

(0) ShareShare
ReportReport
Posted on by 33

I have set up a Microsoft flow to trigger when rows in my Smartsheet are updated. I followed this tutorial on how to update values in an ArcGIS Online hosted feature service using the ArcGIS REST API. Everything works as it should using Postman. I noticed however that the ArcGIS Rest API is expecting multipart/form-data including key value pairs for f:"json" and then the associated updates. Postman handles this natively by selecting the form/data option for the body and automatically creates boundaries. MS flow apparently does not handle multipart/form-data natively. How do I structure my body to pass a valid POST request to the API to update my feature service? Screenshot of MS Flow HTTP Post below. Also below is the successful POST from Postman using the exact same data.

 

 

From Postman Console. This successfully posts:

Request Header:
User-Agent:"PostmanRuntime/7.15.0"
Accept:"*/*"
Cache-Control:"no-cache"
Postman-Token:"8988b891-ad8f-4e9f-8be0-965ad2711ecc"
Host:"services.arcgis.com"
accept-encoding:"gzip, deflate"
content-type:"multipart/form-data; boundary=--------------------------113767685070943500397041"
content-length:467
Connection:"keep-alive"
Request Body:
f:"json"
updates:"[ { "attributes" : { "objectId": 3, "MissionDate" : "2019-06-27T07:00:00.0000000", "MissionName" : "Waste Transfer Facility Promo Shots", "Status" : "pending_review" } } ]"

 

Categories:
I have the same question (0)
  • v-yamao-msft Profile Picture
    on at

    Hi @TechServSup ,

     

    I have searched online and found out the following similar thread on HTTP Post multiple/form-data, please check it for a reference:

    https://powerusers.microsoft.com/t5/Building-Flows/HTTP-Post-multipart-form-data/td-p/145181

     

    Best regards,

    Mabel

     

  • Verified answer
    TechServSup Profile Picture
    33 on at

    Thanks @v-yamao-msft,

     

    The other thread was very helpful. 

     

    I finally got this working and I want to share the solution and some things I have learned about MS Flow and testing the ArcGIS REST API using Postman. Maybe you seasoned programmers know this stuff, but I sure didn't. Ultimately, and most importantly it is possible to use the MS Flow HTTP trigger with the ArcGIS REST API to edit features, but it is a little tricky. The most annoying thing I found (and I'm not sure if MS Flow is at fault or the ArcGIS REST API) is almost always the response from the API will be 200 (Success), even though it is not successful. Below is a malformed request, but you can see we get a 200 back. It should respond back as a 400:

    For awhile, I thought that my Flow was working properly, until I realized my features were not updating. Lesson learned, do not trust or rely upon feedback from MS flow. This little green box is deceptive.

    I also learned some valuable info about Postman. I assumed that pasting in the raw sent request from the Postman Console into the body of the Flow HTTP trigger would work. (Because hey, the request works great in Postman - everything updated as it should). But even in "raw" mode, the console doesn't actually show the true request that was sent to the API. However, the "Generate Code Snippet" tool in HTTP mode does. This ultimately helped me figure out what to paste into the header and body portion of Flow.

     

    Ultimately, pictured below is how you would format your header and body (configure your token for authentication under the "Show advanced options" at the bottom) to successfully POST to a feature using the ArcGIS REST API to update attribute features. The main trick is defining your boundary (unique string of characters which separates your different forms in the body) in the header (in my case I just used what Postman auto-generated, but it could be anything). I hope this saves you some time if you want to use MS Flow and the ArcGIS Rest API. 

  • Sheway Profile Picture
    2 on at

    Hi All, 

    I tried below solution but it dint work out and nothing pushed from my request.

    Could someone please help me redirect in correct direction or paste some working example.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard