When using IODocs as an API explorer, I would like to decide whether or not to pass a variable at all. For example, if I want to have an endpoint that lists users, I would like to be able to have a querystring variable that, if present, either filters users that are active or inactive. So, the following URL's would return the following:
http://api.example.com/v1/users - return a list of all users
http://api.example.com/v1/users?active=true - return a list of active users only
http://api.example.com/v1/users?active=false - return a list of inactive users only
Is there a way to define my API in IODocs so that I can use the API to construct all three URL's (including the first one which I cannot find a way to do if I create an 'active' querystring variable).
Perhaps one UI technique would be to have an 'x' all the way right which appears on mouseover, and if you click the 'x', the box is grey'ed out.
"name": "Example Endpoint",
"MethodName": "Get users",
"Synopsis": "Returns a list of users.",
"EnumeratedList": [ "", true, false],
"''": "Return a list of all users",
"true": "Return a list of active users only",
"false": "Return a list of inactive users only"
I noticed after making this example that this post is 3 months old. Hope you've already found a solution; if not, I believe this should do about what you asked. The empty string in EnumeratedList is redundant with Default also set as an empty string, so one of those can be removed. With an empty string, the first case you listed should be generated, and with true and false, the second and third cases respectively should be generated.
Thank you Vijay. That is correct.