1115
Views
2
Comments
Solved
[Consume REST API] Sending Parameters in Body
Question

I am consuming a API that require parameters in the body but I do not know how to test it inside the testing tab so I can get the proper response. Given that the API works with a call from Postman Software, it doesn't work well in OutSystems even in the same request format. To solve the problem, I hope I can use the Test so I can find out the problem. For the API, it is expecting: 

  • method: post request 
  • type: application/x-www-form-urlencoded
  • 9 post parameters in the body

I know how to send it in the normal call. It is to add the input variable to the API Server action and set them send in the Body. Also, set the Request Format as Form URL Encoded. However, I don't know how to make such a call in the testing mode. 

2018-11-07 02-41-33
André Dinis
Solution

Hi Kennedy HO,

Check if this guide by Harlin Setiadarma helps.


Best regards,

André

UserImage.jpg
Kennedy HO

André Dinis wrote:

Hi Kennedy HO,

Check if this guide by Harlin Setiadarma helps.


Best regards,

André

Hi Andre, 

Thanks a lot! It works! Apart from that, I also find out why I cannot make the API call properly. The issue is due to the encoding problem in OutSystems. Like what the post is said, the solution is should replace "+" by "%2B" on the OnBeforeRequest callback. Or for me, I used the replace() function. 

Many thanks! 

Cheers,
Kennedy


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