I have a curl command, how can i implement the same command and get the response using apigee edge. Below is the curl command.
curl -X GET --header "Tenant: xyz" -u username:password "http://<IP>/api/v3.1/blueprints?_include=id"
1. how can i send this header info which is : "Tenant: xyz"
2. How can i send username and password using apigee edge
Any help is much appreciated.
We can use a Basic Authentication & Service Callout policy,
You need to pass the username & password in some way or use a KVM to fetch them.
Usee Basic Authentication policy to generate a base64 string,
<BasicAuthentication name="ApplyBasicAuthHeader"> <DisplayName>ApplyBasicAuthHeader</DisplayName> <Operation>Encode</Operation> <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables> <User ref="request.header.username" /> <Password ref="request.header.password" /> <AssignTo createNew="false">request.header.Authorization</AssignTo> </BasicAuthentication>
<ServiceCallout async="false" continueOnError="false" enabled="true" name="Service-Callout-1"> <DisplayName>Custom label used in UI</DisplayName> <Request clearPayload="true" variable="myRequest"> <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables> <Set> <Headers> <Header name="Tenant">xyz</Header> <Headers/> <QueryParams/> <Verb>GET</Verb> </Set> </Request> <Response>calloutResponse</Response> <Timeout>60000</Timeout> <HTTPTargetConnection> <URL>http://<IP>/api/v3.1/blueprints?_include=id</URL> </HTTPTargetConnection> </ServiceCallout>
Thanks for response @Siddharth Barahalikar, I tried using KVM when i clicked on my apigee endpoint. it is failing with error : "{"fault":{"faultstring":"The Service is temporarily unavailable","detail":{"errorcode":"messaging.adaptors.http.flow.ServiceUnavailable"}}}apigee-not-able-to-reach-target-endpoint.jpg"
But from my target host i can access apigee rest apis using curl. I tried that and it works fine.
curl -u username:password -v https://api.enterprise.apigee.com/v1/o/goel9ankit-eval/apis/
Please suggest what can be wrong.
Attached is the trace screen shot showing where exactly my request is failingapigee-not-able-to-reach-target-endpoint-2.jpg
My guess is, you are using Apigee Cloud account & trying to access a service which is not available in the public domain.
Kindly confirm that, you can access this endpoint on the Internet (http://<IP>/api/v3.1/blueprints?_include=id)?