API Connect

 View Only

 Format of invoke response body in APIC — Why Buffer instead of JSON?

Mounika Nayikoti's profile image
Mounika Nayikoti posted Thu July 31, 2025 06:06 AM

I have a setup where:

  • I have both a proxy API and a backend API.

  • The backend API is configured to return Content-Type: application/json.

  • The proxy calls the backend API using an invoke policy. ['tokenResponse' is my response object variable]

When I inspect the invoke response object in the proxy (e.g. context.message.body.write(JSON.stringify(context.get('tokenResponse'))) ), the body property shows as: "body":{"type":"Buffer","data":[123,34,97,99,99,101,115,115,95,116,111,107,101...}" Instead of a parsed JSON object.

My questions:

  1. In what format does APIC store the invoke response object?

  2. Why is the JSON response represented as a Buffer?

  3. Is using a Parse policy the only recommended way to convert the buffer to a JSON object, or is there a direct way in GatewayScript?

I want to understand the expected behavior and best practice for handling backend JSON responses in proxy APIs.

Thanks in advance for any guidance!