Building Target Endpoint Path from query parameter

Not applicable

I want to perform the following thing

The proxy server will describe the API as:

www.apigee.net/stuff?date=12&time=99

I want to extract all the query parameters(i did that) and build the backend target as:

www.target.com/stuff/12/99 . (aka. www.target.com/stuff/date/time)

How do I achieve that? I tried AssignMessage Policy and assign variable using the target.url but since my target host is defined in the environment using the target server name, I don't want to hardcode stuff. (i followed this thread but this is not helping. https://community.apigee.com/questions/4303/how-do-i-transform-the-path-between-the-proxy-and.html)

Solved Solved
0 3 1,416
1 ACCEPTED SOLUTION

Hi @Fazle Tanjil, please provide your Assign Message Policy & HTTPTargetConenction details.

Meanwhile, did you try this?

<HTTPTargetConnection>
        <LoadBalancer>
            <Server name="target1"/>
            <Server name="target2"/>
        </LoadBalancer>
        <Path>/stuff/{request.queryparam.date}/{request.queryparam.time}</Path>
</HTTPTargetConnection>

View solution in original post

3 REPLIES 3

Hi @Fazle Tanjil, please provide your Assign Message Policy & HTTPTargetConenction details.

Meanwhile, did you try this?

<HTTPTargetConnection>
        <LoadBalancer>
            <Server name="target1"/>
            <Server name="target2"/>
        </LoadBalancer>
        <Path>/stuff/{request.queryparam.date}/{request.queryparam.time}</Path>
</HTTPTargetConnection>

Thank you so much. That worked. don't know why I didn't try that.

<Server name={my_target} />

Can I use variable in Server name???  seems impossible during my try. 

Thanks!