Best practices to generate one response for the frontend from different backend system

Hi All,

I am searching for the best way to deliver the below functionality with Apigee Edge.

I have multiple backend systems that provide different response structures and need different parameters as inputs or different request structures and I need to expose one REST API which will be consumed by the frontend/mobile app.

The exposed REST API will receive the target backend and other parameters then do the business logic by calling the target backend system then transform the returned response from the target backend to the needed response for the frontend/mobile app.

Thanks,

Solved Solved
3 1 79
1 ACCEPTED SOLUTION

Within Apigee, you can use AssignMessage to modify the request and/or response. 

One possible scenario is

  • configure an Apigee proxy to connect to a target system (maybe with conditional routing) 
  • receive the response
  • extract key dtaa from the response with ExtractVariables policy
  • use AssignMessage to create a new response message, embedding some of the data extracted from above
  • send that new response to the caller

A variation on that would be using the XMLToJSON policy, to transform an XML response from the backend to a JSON response for the caller.  But this idea, mediating the response, is a general one, and you can do lots of different things. JSON to JSON, XML to XML, field filtering, etc etc. 

 

View solution in original post

1 REPLY 1

Within Apigee, you can use AssignMessage to modify the request and/or response. 

One possible scenario is

  • configure an Apigee proxy to connect to a target system (maybe with conditional routing) 
  • receive the response
  • extract key dtaa from the response with ExtractVariables policy
  • use AssignMessage to create a new response message, embedding some of the data extracted from above
  • send that new response to the caller

A variation on that would be using the XMLToJSON policy, to transform an XML response from the backend to a JSON response for the caller.  But this idea, mediating the response, is a general one, and you can do lots of different things. JSON to JSON, XML to XML, field filtering, etc etc.