How to return 'int 0' for the client receive 'int 0' through the REST API

How to return 'int 0' for the client receive 'int 0' through the REST API

  

Hi. I'm Esaki.


I'm trying to create Expose REST API that returns integer response parameters (e.g. 0, 1, ...) .


However, the client receives ' '(null value) when I assign 'int 0’ to the response parameter.

Otherwise, the client receives 'int 1' when I assign 'int 1' to the response parameter.


In my recognition, the client can receive 'text 0' when I  assign 'text 0’ to the response parameter.

But this doesn't work for our development.


So, could you please tell me how to return 'int 0'  for the client receive 'int 0' ?


Solution

Hi Takahiro,

This is a feature of the REST API that allows you to select whether you want to send default values or not (0 is the default value for int). when you expose a REST API, one of the properties is "Send Default Values". By default it is set to "No", which means they aren't sent. If an external service wants to connect to your API (as opposed to another OutSystems application), it's best to set it to "Yes".

Solution

Thank you for your answer, Kilian!

It succeeded!!


Kilian Hekhuis wrote:

Hi Takahiro,

This is a feature of the REST API that allows you to select whether you want to send default values or not (0 is the default value for int). when you expose a REST API, one of the properties is "Send Default Values". By default it is set to "No", which means they aren't sent. If an external service wants to connect to your API (as opposed to another OutSystems application), it's best to set it to "Yes".



Glad I could be of help. Happy coding!