Summary
A common requirement when sending/receiving data is to use an existing service. However, calling an external API may require a specific configuration. In this post I will explain how to configure Power Automate Desktop to use a REST API as service using the Invoke Web Service action.
Prerequisites
Requirements
The requirement for this walkthrough will be edit a profile information by submitting data using the following:
URL | [base-url]/profile/info |
Method | POST |
Content type | multipart/form-data |
Form data | name, surname |
Configuring the API
You can skip this step if the API that will be consumed is already configured.
The first step is to make sure that the API method is configured correctly to allow receiving data into chunks. In ASP.NET Core this is done by adding the Consumes attribute to the publicly facing method, like so:
[ApiController]
[Route("[controller]")]
public class ProfileController : ControllerBase
{
[HttpPost]
[Consumes("multipart/form-data")]
[Route("info")]
public async Task<IActionResult> PostInfoAsync()
{
// Do work
return Ok();
}
}
Testing the API method using Postman
You can make sure that you have configured the method correctly with Postman by setting the body to form-data and providing a list of keys and their corresponding values. This will useful later when you need to configure the Invoke Web Service action in Power Automate Desktop.
After you have provided the data, click on Send to submit the request to the service. You should receive a 200 OK response from the service if everything was configured correctly.
Postman provides snippets of all kinds, but the one that you are interested in is HTTP.
As you noticed, the snippet not only specifies in Content-Type the type of data that you want to submit, but also a boundary parameter. You need to include this as is in the Invoke Web Service action to work as expected.
Calling API method using Power Automate Desktop
After making sure that the API method works, the last step is to simply configure the action in Power Automate Desktop like so:
Encoding request body
One important step is to make sure that the option to encode the request body matches the configuration at the receiving end.
Encoding a request body means that Power Automate Desktop will encode the entire body, including query-string values. If characters such as blanks and punctuation are passed in an HTTP stream, they might be misinterpreted at the receiving end.
Enabling the Encode request body option in the Advanced section converts characters that are not allowed in a URL into character-entity equivalents. For example, when the characters < and > are embedded in a block of text to be transmitted, they are encoded as %3c and %3e respectively.
If using curl i can do that.
What i ask is uploading files pure using only action invoke web service.
I am just hoping they can integrate this feature in that action.
No need to use another solution when dealing with upload files.
Hi @yoko2020
I guess this is gonna depend on the API you're currently using but here is an example from a project I'm working at:
First, I send a request to signalize to the API that I'm gonna send a file to it. If successful, the API returns the URL I must send the file to:
Second, I upload the file to the URL using curl:
Show us example to upload files using invoke web service.
Michael E. Gernaey
497
Super User 2025 Season 2
David_MA
436
Super User 2025 Season 2
Riyaz_riz11
244
Super User 2025 Season 2