user1032531 user1032531 - 1 month ago 10
reST (reStructuredText) Question

How should REST API accept boolean values?

Resource 123 has a current configuration state and a default configuration state, and both of these configuration states can be represented by JSON.

A GET request to http://example.com/123/config will return the current configuration state, and a GET request to http://example.com/123/config?reset=true will return the default configuration state.

How should an API interpret boolean values? For instance:


Answer

Whichever way you want it to, it's completely up to you as the architect/designer. true/false is the most syntactically correct version, make sure that one works and add the other options as sugar if you want.