cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TomJo
New Member

Custom Connector : x-www-form-urlencoded body : invalid JSON

Hi 

 

I would be very grateful of anyone's help.  I need to create a custom connector which will call a REST API from an on premise application across our data gateway.

 

I have a GET request working nicely so the gateway connection is working correctly but I am running into problems when using a POST request because of the required format of the BODY payload.  I have the call working correctly in POSTMAN but importing the definition or creating manually in the custom connector is not working.

 

I have created a policy which updates the http header to the required x-www-form-urlencoded content-type but this doesn't change the validation on the body content entry.

 

My question is,  in postman you can create a nice key (input_data) value ( {myJSONStructure}) pair which generates the body structure 'input_data={myJSONStructure}' which is what this API expects.

 

In the custom connector it wont accept input_data={myJSONStructure} as it its not valid JSON, how can I enter the required JSON structure into the custom connector so the body payload is generated input_data={myJSONStructure}

 

any help gratefully received.

 

 

1 REPLY 1
Syndicate_Admin
Administrator
Administrator

Very hard to debug w/o actual details.

First of all, it isn't clear how the JSON payload is encoded in the form data payload. It is really uncommon - and OpenAPI 2.0 doesn't support it.

 

We dont have UI support for formdata. But, if you are able to author the swagger spec yourself, it should work.

Your operation should look like below:

 '/path': {

    operationId: PostCalll,

    consumes: [ "application/x-www-form-urlencoded" ],

    parameters: [

      {

         name: input_data,

         in: formData,

         type: 

      }

    ]

  }

 

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Users online (3,629)