Have a Problem in consuming REST API

I am trying to Consume Holidays API to get a list of Holidays in REST API but its resulting a bad request error.

I have attached a oml where I tried to get a holiday list ,kinldy modify it with corrections if possible!!

Hi Varada,

Where you able to successfully consume the API using a tool like Postman or SOAPUI?

If so then use the response of those calls as response structure in OutSystems and try again.

Regards,

Daniel

Daniël Kuhlmann wrote:

Hi Varada,

Where you able to successfully consume the API using a tool like Postman or SOAPUI?

If so then use the response of those calls as response structure in OutSystems and try again.

Regards,

Daniel

I didn't try using SOAPUI ,here is the Url of the rest API i am trying to use..

https://holidayapi.com/v1/holidays?pretty&key=d576e5e4-c3a4-4891-bc1f-dd97b1f75669&country=IN&year=2018

,Please modify the attached oml with corrections!

Thanks and Regards,

Varada Rajan


Solution

Hi Varada,

You need to change Data Type of Year to Integer and use just a Year in GetHolidays input parameter


EDIT.

Also place ListRecords1 under ResponseContainer, because in action OK you AJAX Refresh this container but it is empty

Solution

varada rajan wrote:

I have made those changes but its still resulting a "Bad request Error"


Both Year parameters on Screen and GetHolidays must be an Integer. Also on action OK input value of GetHolidays must be simple Year, not TextToDate(Year). 




Thanks much .It just worked fine now.


Varada,

you're welcome. Also best practice to store Key value to access API in Site Properties