javascript policy to call external URL or REST Endpoint

How can we call external URL or POST request to rest endpoint from Javascript policy?

I tried to invoke call using XMLHTTPRequest object but seems not working. How can I do this to send requet to another external or public API

@Anil Sagar

Can you share solution for this problem sending e-mail or GET request from a javascript/policy

Thanks

Suresh

0 3 2,169
3 REPLIES 3

@Suresh have you tried exploring the option of using a Service Callout policy?

http://docs.apigee.com/api-services/reference/service-callout-policy

HI @Suresh

Those are browser based methods you are trying to invoke. They wont work in Edge. Using JS policy, you can make http calls. There are some httpclient objects exposed in Edge you can leverage for making http calls. More info here

We have samples as well - Check this link

Hope this helps !

Thanks a lot!!

Initially I tried this script in Cloud /Trail Org and seemed was not working properly. After that I copied this script in Edge and executed via JSC seems working fine.

Shall we invoke external Python Scripts to send E-Mail notification via Python Policy Call out.

I think notifications can be leveraged from Apigee notifications eature, but our private cloud is not configured with Apigee notification.

Once again thanks to you!