I am assessing Airtable as a method to store data that will be used to control a contact centre system.
This system will use REST API calls to retrieve data in JSON format.
This works ok but I am a bit confused about the Checkbox record type, which seems to be a boolean type, does not act as such for API queries.
If the Checkbox is ticked the JSON response contains the filed name and a value of true. If the Checkbox is not ticked the JSON response does not contain the field name. My expectation would be that the JSON response should contain the field name and a value of false.
Not having this will cause the parsing of the JSON response to be more complex than I would like. I will have to code for the key:value pair being missing rather than a simple true/false situation.
Is there any reason for this working the way it does? How have others coped with this design quirk?
This is standard procedure for a REST API. If a value is empty/blank, it is not included in the response in order to reduce network traffic.
Another workaround is to use a formula field that converts the checkbox to a different value type, such as a number. Then have your system ask for the formula field instead.
Thank you for the response. What you state makes sense but my thoughts are is a boolean false really a blank value? Omitting this may save some network bandwidth but the tradeoff would seem to be increased complexity in processing the response.
I am sure that you are correct and that Airtable follows the correct standard/convention. Is there a reference that you can point me to that confirms this? - I am keen to learn best practice.
I have found an interesting article that suggests avoiding booleans as they can reduce extensibility - it includes an example of Github originally using a boolean for whether a repository was private which had to be changed to allow multiple values for repository status (private, public, internal).