在 Apigee 中,如何访问 javascript 政策中的标注响应

问题描述 投票:0回答:2

我创建了一个服务标注(例如:

myCallout
),它在变量中返回其响应(例如:
myCalloutResponse
)。如何访问 javascript 策略中的标注正文? 我尝试了
context.getVariable("myCallout.myCalloutResponse")
和其他一些方法,但无法让它发挥作用。 谢谢

apigee callout
2个回答
4
投票

context.getVariable("myCalloutResponse.content") 应该为您提供有效负载。查看响应对象上可用的其他变量 - 以提取您需要的数据。


0
投票

您可以使用:JSON.parse(context.getVariable("myCalloutResponse.content"));

© www.soinside.com 2019 - 2024. All rights reserved.