Rest-api-doc icon indicating copy to clipboard operation
Rest-api-doc copied to clipboard

Optional query parameters that don't require values

Open raffian opened this issue 11 years ago • 0 comments

Our REST services return hierarchical data. Some clients, however, prefer flat data, so we offer the option to flatten the response using this convention:

/customer{customer_id}/?$flatten

We documented $flatten like this..

   @RestApiParam(name="$flatten", 
                 type="String",
                 paramType = RestApiParamType.QUERY)
defaultParamsQueryAll = 
   [[name:'$flatten',
     paramType = RestApiParamType.QUERY,
     description:"Flattens response to tabular format"]

In both cases, however, the parameter displays with an input field in Playground; this is normal, but not normal for parameters that don't take values, creating request URL like this:

/customer{customer_id}/?$flatten=

We suggest support for new parameter type:

paramType = RestApiParamType.QUERY_NOVAL

For such parameters, instead of showing input field in Playground, show checkbox instead, when selected, the parameter (without a value) is added to the query string:

/customer{customer_id}/?$flatten

raffian avatar Oct 26 '14 01:10 raffian