I'm a bit confused while debugging an API response. When I used fetch() with javascript and logged the result to the console, I saw that a property called coordinates contained an array with 694 elements. However, when I used an OutSystems Service Action to call the same API, I noticed that the coordinates key didn’t return the same number of elements. I used a structure to hold the response values from the API. Does anyone know why this might be happening?
Can you set the Logging to Full in Service Center and check the Log File generated? This file will contain what is been sent and received.
I'm sorry, it turns out there was a difference in the request content when using JavaScript and when using the OutSystems REST API consumption. I have now managed to get the same result. Please forgive my oversight.
@Muhammad Fadhli Azhar
OutSystems can be a bit more of a stickler when reading the API's data compared to Node.js. If the coordinates array isn't perfectly formatted, OutSystems might get confused and miss some pieces, leading to fewer elements than you expect.
To figure it out, try this:
Thanks for the suggestion @Neha Agrawal
I am getting the same result now between using javascript and OutSystem service action. I was just careless with the request value while using the service action. I will be more careful next time
Hi @Muhammad Fadhli Azhar,
If your Coordinates structure is not correctly set to handle a dynamic or larger array, only part of the data may be deserialized, or the rest could be silently discarded.
Can you pls make sure that you always getting the correct structure in Coordinates list like X coordinate and Y coordinate.
Inspect the raw API response by setting the Logging to Full in Service Center or use the LogMessage action to debug the issue.
I think you're right about the importance of matching the structure with the API response. However, it turns out the issue was simply due to me providing different values when using JavaScript and the OutSystems service action. I'll be more careful moving forward. Thank you for your suggestion