Hello,
I'm new to Apigee and I'm trying to do a very basic action (i'm on a evaluation account) : a transformation of my endpoint and these settings
Here is my target url :
https://targetendpoint.com/{client}/{client_document}.json
As you can see there are two variables et one extension : client, client_document and the ".json"
I don't find it very pretty and I would like to simplify
I would like my proxy to look like this : https://proxyendpoint.com/{client}-{client_document}/
(we agree that it is not necessarily a clean solution to go down a level and add a dash but it is only for the test)
Is it possible with Apigee?
How can i do ? It would be a question of making a policy in a preflow?
Thank you for your possible solutions!
Solved! Go to Solution.
In your proxy flows, you can parse the incoming path with https://cloud.google.com/apigee/docs/api-platform/reference/policies/extract-variables-policy#uripat.... Assuming that you stash them away as 'client' and'document' under 'parsed.var', you then inject them into your TargetEndpoint. In your TargetEndpint you can set <Path>{parsed.var.client}-{parsed.var.document}.json</Path> within HTTPTargetConnection. I think you have to disable `target.copy.pathsuffix` (https://docs.apigee.com/api-platform/reference/variables-reference) for it to work, but I'm not certain.
In your proxy flows, you can parse the incoming path with https://cloud.google.com/apigee/docs/api-platform/reference/policies/extract-variables-policy#uripat.... Assuming that you stash them away as 'client' and'document' under 'parsed.var', you then inject them into your TargetEndpoint. In your TargetEndpint you can set <Path>{parsed.var.client}-{parsed.var.document}.json</Path> within HTTPTargetConnection. I think you have to disable `target.copy.pathsuffix` (https://docs.apigee.com/api-platform/reference/variables-reference) for it to work, but I'm not certain.
Hello and thank you for your response.
I am testing with assign message (to get the variables) first then extract variables (to set the url)
For the moment it seems to work, thank you: I will finalize my test before confirming that it is OK
(and if others have opinions about my question !)