Consume Rest API with a Response Data type of Binary

Consume Rest API with a Response Data type of Binary

  

Hi Community,

Good day!

Just like to ask on how to (not sure what's the right term) serialize the Array of Objects with fields, a response from the API consumed.

The platform has automatically created the structure but don't know on how to populate the declared record variable using the defined structure.

Attached is a sample screenshot of the response structure/data.


Thank you and regards,

Chris

Hi Christopher,

I'm not sure what you mean. If you add JSON to the Response, then indeed the Platform creates a Structure with the Attributes supplied (and an inferred Type). But this is the output of the REST API's Method, so why would you want to populate it?

Hi Killian,

Thanks for the reply.

What I mean is based on the Response by the API (record is in Binary data type), how do I assign it to the variable (will be using to display data), converting the Binary data to a readable record.

Thanks,

Chris

Solution

Hi Christopher,

The platform should handle that for you transparently... it defines the response Structure for you when you first setup a consumed method, and it will also populate it with the response from the REST method when you call it.

I'm not sure where do you see the record returned is binary, according to your screenshot, it is defined as regular JSON format and is a single record, not an array...

Solution

Hi Jorge,

Got my issue working.

I was missing a step.

Apologies, I was referring to the Response Format as Binary.

I was using the BinaryDataToText API but I was missing the next step were in I should deserialize it.

Please see attachment.


Anyways, Thanks Killian and Jorge for the response.


Kind regards,

Chris