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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / application/x-www-form...
Power Automate
Unanswered

application/x-www-form-urlencoded request for my custom connector, doesn't form the body properly

(2) ShareShare
ReportReport
Posted on by 14

Hello!

 

I'm building a logic app custom connector in Azure for my APIs.

the API use `application/x-www-form-urlencoded ` as a content-type, basically i want my custom connector to perform this:

 

curl "https://test.api.xxxx.com/xxxx/token" \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -d "grant_type=client_credentials&client_id={client_id}&client_secret={client_secret}"

so my swagger v2.0 looks like below, as advised from another post https://powerusers.microsoft.com/t5/Connector-Development/How-to-send-x-www-form-urlencoded-body/m-p/2178579#M2358

 

 

 

 

 

swagger: '2.0'
info:
 version: 1.0.0
 title: xxxxx
 description: xxxxx
host: test.api.xxxx.com
basePath: /
schemes:
 - https
produces:
 - application/json
paths:
 /xxxx/token:
 post:
 summary: Access Granted Client Credentials
 description: ''
 operationId: Oauth2Token
 deprecated: false
 consumes:
 - application/x-www-form-urlencoded
 parameters:
 - name: Content-Type
 in: header
 required: true
 type: string
 description: ''
 default: application/x-www-form-urlencoded
 - name: grant_type
 in: formData
 required: true
 type: string
 description: ''
 - name: client_id
 in: formData
 required: true
 type: string
 description: ''
 - name: client_secret
 in: formData
 required: true
 type: string
 description: ''

 

 

 

 

 

if i use swagger Editor to try, and it successfully works (i can authenticate).

but once i saved my connector and try in a test logic app, I got error from my API (meaning at least the API went through) `Mandatory grant_type form parameter missing`. this error is coming when the grant_type is not properly passed. so i have checked my input raw in logic app and looks like this :

 

mkarin_1-1685532318915.png

 

grant_type as client_credentials is there as a form-data, header is there `application/x-www-form-urlencoded`. I would like to check the real request that this logic app has sent but it looks like i can't check the log. I believe that logic app is override the header or putting the parameter not encoded, or put them somewhere else. (i don't know, there is no log!)

 

I have even tried to change my swagger, from `formData` to `query`, but it doesn't work.

 

I have tried to create a maunal HTTP request in a logic app to perform what i want to do with my custom connector, and it perfectly works well. and the body in input raw file looks like this :

mkarin_0-1685544424111.png

 

My questions are : 

- Is there any way that i can check the log to check how the request looks like?

- how to make body correctly built as below (or same result as manual HTTP)

"grant_type=client_credentials&client_id={client_id}&client_secret={client_secret}"

- How can I properly send the application/x-www-form-urlencoded request? i know that i can perform this by modifying my flow, but my goal is to create a custom connector to do the job for my API users.

- can anyone have same issue? 

 

 

 

Categories:
I have the same question (0)
  • Minam-r4 Profile Picture
    47 on at

    Hello,

     

    To resolve the issue you're facing with the "x-www-form-urlencoded" body format, I recommend following these steps:

     

    1. Start by referring to the provided document, "Monitor Diagnostic Data In Azure Logic Apps." This document will guide you on how to create logs for your Azure Logic App.

    2. Review and correct the "x-www-form-urlencoded" body format. As mentioned, the URL-encoded parameters should be separated by ampersands (&), and each parameter should consist of a key-value pair separated by an equals sign (=). In your case, the corrected format would be: "grant_type=client_credentials&client_id=<actual_client_id>&client_secret=<actual_client_secret>".

    3. Ensure that the corrected URL-encoded body structure is properly used in your Custom Connector. Verify that all the required parameters are included and in the correct format.

     

    By following these steps, you should be able to address the issue you're experiencing with the application/x-www-form-urlencoded request format. If you encounter any further difficulties, please don't hesitate to ask for additional assistance.

     

    I hope this solution helps resolve your issue.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 707

#2
Haque Profile Picture

Haque 475

#3
Valantis Profile Picture

Valantis 456

Last 30 days Overall leaderboard