Extract Variable with colon

I have the following endpoint:

api/proejcts/{uuid}:action

I want to extract the uuid variable.
I tried:

<URIPath>
        <Pattern ignoreCase="true">/projects/{uuid}</Pattern>
        <Pattern ignoreCase="true">/projects/{uuid}:action</Pattern>
</URIPath>

But the variable is extracted with the :action suffix:

8345d473-a38f-4e1d-ac24-531e48637ca1:action

Is it possible to extract only the uuid?
thanks

Solved Solved
1 8 377
1 ACCEPTED SOLUTION

Ok, I found the answer.
I just need to flip the patterns:

<URIPath>
        <Pattern ignoreCase="true">/projects/{uuid}:action</Pattern>
        <Pattern ignoreCase="true">/projects/{uuid}</Pattern>
</URIPath>

View solution in original post

8 REPLIES 8

Ok, I found the answer.
I just need to flip the patterns:

<URIPath>
        <Pattern ignoreCase="true">/projects/{uuid}:action</Pattern>
        <Pattern ignoreCase="true">/projects/{uuid}</Pattern>
</URIPath>

YES. And why ? The patterns are checked in the order in which they appear in the policy configuration. When the first pattern matches, the policy does the extraction and then does not evaluate further patterns.

I'll just add that according to the docs it tests for all patterns and the longest wins.

Thank you! For pointing that out. Let me follow-up to confirm that I am not mistaken. Either I am mistaken or the documentation is misleading. Either way, we'll get it fixed.

From my testing, the docs are correct

Not applicable

only this would work as well.

<URIPath>
        <Pattern ignoreCase="true">/projects/{uuid}:action</Pattern>
</URIPath>

You're correct, but I need the other pattern as well. thanks

Hi!!

You can use string manipulation

Ex String.Split(":") you can use this function
:slight_smile: Best Paintball Gun Hopper2020