Likely Rest API Output Data Structure issue - How to debug?

I'm trying to consume the Microsoft Calendar API but having trouble with the Service module I made returning an empty variable. API logging shows the response from Microsoft is about what I expect and authentication is OK. 

I assume the problem is the complex return structure for the API call is not quite right, there are over 100 elements.  Does anyone know how to get an error or debug information back which explains why the return variable is blank?



Solution

Hi Krobar,

have you tried to consume the same API in postman? and observed the behavior?

that will give you more in dept detail.


Regrads,

Manish Jawla

Solution

Hi Krobar,

Another thing you can try is, creating an OnAfterResponse action of the API and there you can see what is the response text you are getting.

Already have that; module debug seems to work better as it captures the whole API response.


Nikhil Gaur wrote:

Hi Krobar,

Another thing you can try is, creating an OnAfterResponse action of the API and there you can see what is the response text you are getting.



The solution was ultimately provide by the response below but I just want to mention quite a nasty caveat. Outsystems seems to limit text fields to 2000 character unless you define a higher limit. The Rest API implementation does not set a higher limit even when the example data exceeds 2000 characters. In my case I needed to set the content field limit to 50000 character and then it worked.


Manish Jawla wrote:

Hi Krobar,

have you tried to consume the same API in postman? and observed the behavior?

that will give you more in dept detail.


Regrads,

Manish Jawla



Hi Krobar,

Just for my understanding, you were consuming a REST API, and a Structure Attribute of type Text was cut off at 2000 characters, if you didn't explicitly specify its Length Property to be greater than 2000?

Seems to be worse than that, if I don't specify a large limit for the part of the structure that exceeds 2000 chars it returns an completely empty response for the entire structure. 

Kilian Hekhuis wrote:

Hi Krobar,

Just for my understanding, you were consuming a REST API, and a Structure Attribute of type Text was cut off at 2000 characters, if you didn't explicitly specify its Length Property to be greater than 2000?



So you receive data larger than 2000 characters, and in that case the JSON from the REST service is not parsed correctly? Mmm, that seems like a bug. I'll report it to OutSystems, but I'd advise you to do the same. Thanks for the report!

I'm new to Outsystems hence why I'm not sure. The setup is fairly simple, I have a service module which contains the Rest Consume. The service module has an action which takes the 3 required inputs and passes them to the REST call, it then places the REST response in "Response" output variable. The structures and action are then exposed so that the front end module can consume them.

In the structure below the Content attribute often exceeds 2000 characters.  If I leave the Content attribute length at the default of 0 it seems to silently fail and return an empty object to the front end app (I can capture the full API response in Integration logs as debug is enabled and that looks OK). If I set the Length of Content to 50000 with no other changes then it works fine.

Well, I don't think it should fail, but I'm glad you found a work-around. I'll do some tests myself, to see if I can replicate it...