How to send Parameters through Body with body type - multipart/form-data in HTTP Request

Hello All,

I have been struggling to get HTTP Request Activity working for Microsoft API for past 2 weeks. It works fine in Postman/ Insomnia. However, it doesn’t work in HTTP Request activity.

The weird thing about this API is that even in Postman/ Insomnia, it only accepts credentials/ parameters in Multipart Form or Form URL Encoded data. And, I don’t see any way to add Multipart Form or Form URL Econded data in Body field in the HTTP Request activity.
Also, I am not sure whether application/x-www-form-urlencoded OR multipart/form-data should be updated in Body Format or under Header section

Can someone please help me on this at earliest.

My ultimate goal is to use IMAP activity with OAuth2.0 which requires access_token. And, in order to generate access_token, I need to call an API.

Please find below Postman and Insomnia snippets for your reference.

Postman

Insomnia

@Cristian_Negulescu can you please help here? I have already seen your answer on other post where you have suggested to use Invoke Code activity. However, I would like to use HTTP Request activity only as it requires less programming skills and its less complex.

Hello Kiran,
I use VB.NET code for MULTIPART/form-data because I don’t find other solutions to use it with HTTP Request Activity.
All the code is Here:
startUiPathFromSalesforce/FormData.txt at master · cristinegulescu/startUiPathFromSalesforce · GitHub
In my case, I upload files and parameters that’s why I use multipart/form-data in your case I don’t see that you need this.
Take a look at this thread on their solution:
https://community.powerbi.com/t5/Desktop/Azure-HTTP-POST-requests-for-an-access-token-from-Power-BI-power/td-p/968625
It looks that’s is working for all application/json witch is normal.
Thanks
Cristian Negulescu

Hi @kiran.suryavanshi , try creating a big json array with whatever data you need using invoke methods (should look like raw body from postman I think) and then pass it as body inside the http request properties.

Hi @Cristian_Negulescu, sorry for the delay in response. And, thanks for the response.

I also could not find any solution withing UiPath acitvities to send the MULTIPART/form-data. Hence, I ended up using Python which was easy for me.

Thanks :slight_smile:

Hi @s0biesky, thanks for the response. I used python to get the job done. Thank you :slight_smile: