Proxy with Query Parameter calling Target with Path Parameter

kbravo
New Member

Hello,

I have created an API with a query parameter "text". The value of text needs to be appended to the url of the API I am calling as a target.

api.myorg.com/v1/resource?text=foo

calling

api.theirorg.com/product/v4/path/foo.json

So I need to take foo from my query parameter, append it to the url for the target call, then add the string '.json' to it. The default behavior seems to be this:

api.theirorg.com/product/v4/path/resource

It seems like I can use an assign policy to get foo from the query parameters to the path. I'm not sure how do drop the 'resource' or then append '.json.

Any thoughts?

0 1 660
1 REPLY 1

Hi, @Kris Bravo for getting queryparam we can use ExtractVariable Policy.

Then for re-writing the target URL with extracted value & to append .json we can make use of Assign Message Policy on the Target Endpoint

I have created a sample proxy and attached here, please have a look.

krishbravoproxy-rev1-2018-07-27.zip