Hi,
I would like to send the dynamic path in the request uri to target.
1.something like this
/abc(dynamicvalue)?apikey=<apikey>
How can I do this ??
Dynamic value is fetched in extract variable.
Answer by Dino
·
Dec 21, 2017 at 05:45 PM
What you describe happens automatically. For example, suppose the basepath for your API proxy is /svc1 . Suppose there is a single target endpoint with URL https://internal-server.com/foo . Then, for these given inbound requests, the pass-through API Proxy will send these outbound requests:
You don't need to configure anything, beyond a reverse proxy, to make that happen.
Hi Dino,
Thanks for the response.
I got the answer for my question.
I have done adding the dynamic path adding to the target in Javascript and it works.
Can you tell me how u achieved it? I am doing the below scenario
1) i have below setup in PROXY endpoint flow (note:- * , it will be customer id)
<HTTPProxyConnection>
<BasePath>/application/tworder/v1/ip-customers/*/ip-users/</BasePath> <Properties/> <VirtualHost>secure</VirtualHost>
</HTTPProxyConnection>
2) i have below setup in TARGET endpoint flow (need to get the above cusomer id and pass in the target end point)
<HTTPTargetConnection>
<LoadBalancer>
<Server name="appTargetURL"/> </LoadBalancer>
<Path>/application/tworder/v1/ip-customers/{need to replace id value from the proxy URI value}/ip-users/</Path></HTTPTargetConnection>
ineed to cosntruct like:
https://hostName/application/tworder/v1/ip-customers/1234567890/ip-users/
How do i replace the value 1234567890 dynamically? i tried with java-script policy
var a=context.getVariable("apigee.customerId");
var b="/application/ipss/v1/ip-customers/"+a+"/ip-users/";
context.setVariable("target.url", b);
Extract Policy
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ExtractVariables async="false" continueOnError="false" enabled="true" name="Extract-path-variable-from-request">
<DisplayName>Extract-Path-Variable-From-Request</DisplayName> <Properties/>
<URIPath name="customerId">
<Pattern ignoreCase="true">/{customerId}</Pattern> </URIPath>
<Source clearPayload="false">request</Source>
<VariablePrefix>apigee</VariablePrefix>
</ExtractVariables>
Output:- customer is still null
http://ip-userms.sdpamp.com/application/tworder/v1/ip-customers/null/ip-users/ |
hi - Can you post your question as a new question, please?
I don't answer new questions that are posted as comments on answers to old questions.
How to extract SOAP response attachment? 3 Answers
ExtractVariables with line break in json is not working. 2 Answers
How can i convert Xml data to Json and Json to Xml using Extract Variable or Assign Message Policy? 1 Answer
How to Extent the time to get the response from the target to make service callout request. 1 Answer
String Tokenizing the XML Text() and combination of substring decides the Flow-XPATH based 1 Answer