In API blueprint I am looking to specify an optional json element for a POST message. Example for;
### Add a new User [POST]
To add a User send a JSON .....
+ Request (application/json)
{
"name": "A name",
"age": 30
}
How do I indicate to reader of API that age is optional in API call but still show that it's an integer?
~Colin
Currently there is no dedicated support for doing this. However there are few ways how to achieve this.
My preferable is to discuss it in the request description using a markdown formatting of your liking e.g:
or perhaps:
See http://docs.gtdtodoapi.apiary.io Folder Collection resource for a futher example.
You can also always specify a JSON schema describing the body payload. Note dedicated support for discussing message body attributes is in the making (https://github.com/apiaryio/api-blueprint/issues/25)
I recommend table of document fields like this one.
Generated table of fields: http://i.stack.imgur.com/cxocx.png