H4p7ic
H4p7ic

Reputation: 1923

How to get the path/url of an api operation without the api suffix included in Azure api management?

I'm wondering of there is a way to get the operation path / url using a policy in API Management?

What i have been looking at so far is the context variables written between "@()" when trying to get specific values regarding the context of the api i'm currently working at.

More information here.

I've been trying different stuff and the closest i could come to finding what i was looking for was this staement:

@(context.Request.OriginalUrl.Path.ToString())

But as mentioned before that included the api suffix which in this case i want to exclude.

Upvotes: 2

Views: 2852

Answers (1)

H4p7ic
H4p7ic

Reputation: 1923

So I've tested the statement described in the comments above and its exactly what i was looking for. This worked for me: @(context.Request.OriginalUrl.Path.ToString().Replace("[suffix]","")).

Upvotes: 1

Related Questions