Response not displayed in the API console

Hi Everyone, Could you please help me in the following issue?

I have created an API proxy using Route Rule as shown in below snippet.

<TargetEndpoint name=“Endpoint">
  <Description/> 
  <FaultRules/> 
  <PreFlow name="PreFlow">
    <Request/> <Response/>
  </PreFlow>
  <PostFlow name="PostFlow">
    <Request/> <Response/>
  </PostFlow>
  <Flows/>
  <HTTPTargetConnection>
    <Properties/>
    <URL>http://ankit9211-test.apigee.net/api/v1/</URL>
  </HTTPTargetConnection>
</TargetEndpoint>

and now am executing this end point using Javascript like as shown below,

var url = "http://ramesh9211-test.apigee.net/v1/orders/"+
  context.getVariable("orders.orderId" ) ;
print("helooooooooooooooorderId11111 * * " + url);


var data = httpClient.get(url);


if (data.isSuccess()) {
  var responseObj = data.getResponse().content.asJSON;
  print("helooooooooooooooo * * " +responseObj);
  context.setVariable("responseObj ", responseObj);


  if (responseObj.error) {
    throw new Error(responseObj.error_description);
  }
  print("helooooooooooooooo33333 * * ");
}
else if (data.isError()){
  throw new Error(data.getError());
}

so, while am trying to debug my API it is showing the response in Body but it is not displayed in the API Console,

Response received from target server Body {"subscriptionId":"366a192b7913b04c54574d18c28d46e6395428a","orderId":"36","storeId":"9"}

Please help regarding this issue if you have any solution,

Thanks in advance.

Solved Solved
0 4 2,993
1 ACCEPTED SOLUTION

Not applicable

Hello @VENKATA LAKSHMI KONDAPALLI,

Since you are using the print command, you would be able to see the data under the "Output from all Transactions" in Trace Window.

Does this help ?

View solution in original post

4 REPLIES 4

Can you please clarify the question.

- Please use curl or some simple command line based client to first check if API is fine

- Is the problem observed in API console ? or are you referring to tracing feature ?

- Are you calling from ramesh9211 org to ankit9211 org ?

Yes, as Madhan has commented, your question is not clear. Where is the JS code running? Where is the error occurring? In the JS logic? Or in the Target call?

What is hosted on ramesh9211 and what is on ankit9211 ?

I think maybe you need to break down the problem into smaller pieces.

I suggest that you try to figure out one small thing at a time, before linking everything together.

Not applicable

Hi,
The output of print() function is shown in the JS policy log.

To write in the console you need to use console.log() instead of print().

Not applicable

Hello @VENKATA LAKSHMI KONDAPALLI,

Since you are using the print command, you would be able to see the data under the "Output from all Transactions" in Trace Window.

Does this help ?