I'm working on a REST API, and I'm looking for a way to give the client allowed values for a variable in a URI template. This is useful when the variable represents something like an enum. Currently the client gets back a collection of links as part of the JSON object that is returned to it, and I'd like to do something like this:
"Links":
[
{
"Title":"Search Articles",
"HREF":"example.com/articles/search?keywords={keywords}&mode={mode|["allWords", "anyWords", "exactPhrase"]}"
}
]
or this:
"Links":
[
{
"Title":"Search Articles",
"HREF":"example.com/articles/search?keywords={keywords}&mode={mode}"
"Fields":
[
{
"Name":"keywords",
"Type":"Text"
},
{
"Name":"mode",
"Type":"Enum",
"Options":["allWords", "anyWords", "exactPhrase"]
}
]
}
]
This is the closest thing I've found to an answer, but I was hoping for something a bit more official.
I've also been looking at the IETF standards doc for URI Templates, which seems pretty official, but doesn't look like it has an answer for this problem.