user3384231
user3384231

Reputation: 4053

URI template for URL

Can anyone help me on what will be the URI template for the following path?

/testing/action?{Operation}={value}

The {Operation} and {Value} will keep on changing but I am not understanding how will the URI template for this path?

example URL that I expect
1. /testing/action?foo=test12
2. /testing/action?boo=test32

Is there any way I can have the above URL in the form of one URI template?

Upvotes: 0

Views: 180

Answers (1)

Ryan J. McDonough
Ryan J. McDonough

Reputation: 1725

I am assuming you are referring to RFC6570 URI Templates. One way to express it is to use the explode modifier like so:

/testing/action{?operation*}

Your input variables to "operations" would be passed in using name/value pairs:

{ "foo" : "test12" }

This would then result in:

/testing/action?foo=test12

The caveat is that your code will have to enforce that only one value is present in the associative array at a time.

Upvotes: 1

Related Questions