Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To use the API Manager custom policy to make an endpoint call and store the response in the Property Mediator, follow these steps:

  1. Create a new custom policy in the WSO2 API Manager.
  2. Copy and paste the following code into the custom policy:
<policies>
   <inSequence>
      <log level="full"/>
      <send>
         <endpoint>
            <address uri="http://example.com/api"/>
         </endpoint>
      </send>
   </inSequence>
   <outSequence>
      <property name="responsePayload" expression="$body"/>
      <log level="full"/>
      <send/>
   </outSequence>
</policies>
  1. Replace "http://example.com/api" with the URL of the endpoint you want to call.
  2. Save the custom policy.
  3. Apply the custom policy to an API in the WSO2 API Manager.
  4. Make a request to the API.
  5. Check the logs of the API Manager to see the full response from the endpoint.
  6. You can access the response by using the Property Mediator with the following expression:
<property name="responsePayload" expression="get-property('responsePayload')"/>