Looking for Apigee Example - JS Accessing Restful API

Not applicable

Hi - I am looking for an example using Apigee which accesses a Restful API from a Javascript extension - can someone please provide such an example - the Restful API will be returning some meaningful and actionable data and the Apigee platform needs to apply some routing rules in response to the data returned from the API.

1 2 901
2 REPLIES 2

Hi Ghulam, Check out this documentation page, which outlines all the information about JavaScript callouts in Apigee Edge, that use the http client. That page also points you to the github repo where there is a working example of a proxy bundle that uses JavaScript to call out to an external service.

Using JavaScript for this purpose is perfectly reasonable. Keep in mind you could also use the ServiceCallout policy to call out to a Restful API endpoint. Which you prefer is up to you. I generally use Javascript when there is some extra computation that needs to be done before or after the call out. I generally use ServiceCallout + ExtractVariables if it's a simple callout and a JSON extraction. There is also a full page of documentation covering this pattern, as well. And a corresponding working example in Github.

Not applicable

Thanks Dino, that helps - also is there an example show casing a call to a HTTPs endpoint which expects mutual SSL authentication ?