230
Views
6
Comments
Solved
 Record as a Input Parameter for the consumed REST API with Form URL Encoded Requests
Question

Hello All,

I am Consuming the 3rd party REST API with Form URL Encoded Request. I need to send a request with address which is of structure 

 

How can I able to pass the record as a input for the Form URL Encoded Request?.

I have already gone through some of the reference but didn't found any solution

https://www.outsystems.com/forums/discussion/36156/guide-consume-rest-api-with-form-url-encoded-request/

https://www.outsystems.com/forums/discussion/61827/rest-api-form-url-encoded-requests-list-type-input-parameter-error/

Thanks and Regards,

Ellakkiya.S

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
Solution

Hi Ellakkiya,

Simple put, you cannot do this out of the box with OutSystems. Complex data types like collections and lists aren't standardized across REST services with form URL encoding (see also this topic). The best you can do is constructing the payload manually, and send a single Body parameter of type Text with that payload.

2023-12-14 09-56-57
Yogesh Javir

Hey,
While consuming API, you have to pass structure as json with value and test it, when click on test button response get automatically created and request body also get created.

Hope this will understandable.

Thanks

Yogesh

UserImage.jpg
Ellakkiya

Hello Yogesh Javir ,

Thankyou for your reply

My request format is Form URL Encoded, so i cannot able to pass the json 

Thanks and Regards,

Ellakkiya.S

2020-09-01 10-42-42
Stefano Valente

Hi Ellakiya,

When i create a bogus consumed rest API with form url encoding this is what happens:


So, for each field there will be an input parameter in the rest method. You can simply point each attribute in your structure/record to the desired input param of the API method.

UserImage.jpg
Ellakkiya

Hello Stefano Valente ,

Thankyou for your reply 

Yes Exactly, This works fine.

I need to pass the address structure, you can refer the above screenshot i have attached.

Hope this is clear!

Thanks and regards,

Ellakkiya.S

2020-09-01 10-42-42
Stefano Valente

I am not an expert with this content-type, but i am quite sure you can't send structures, only fields. 

Since you are bound to that content-type, i think my example is the only way.


I hope it will fix your problem and answer your question. If so, please choose a post as solution to close this topic.

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
Solution

Hi Ellakkiya,

Simple put, you cannot do this out of the box with OutSystems. Complex data types like collections and lists aren't standardized across REST services with form URL encoding (see also this topic). The best you can do is constructing the payload manually, and send a single Body parameter of type Text with that payload.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.