From the course: Learn API Documentation with JSON and XML

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Documenting JSON requests

Documenting JSON requests

From the course: Learn API Documentation with JSON and XML

Start my 1-month free trial

Documenting JSON requests

- [Instructor] Now that I've covered JSON Responses let's talk about how to document JSON Requests. The table for JSON Requests is identical to that for responses, except that you need a column called Required. When you send a request, not all elements are necessarily required. If an element is optional, the developer needs to know that. In the Required column, I recommend putting either Required or Optional. Often these tables will have Yes or No, or True or False, but if it's a large table, then you may be making the developer scroll up to the top to remember if the column is required or optional. If you use Required or Optional in the table cells themselves, then it's immediately apparent what it means. Let's imagine that we were documenting an API that allows users to add comments to a posting. The JSON might look like this. There is a comment object, which contains key value pairs for a user ID that says who the user is that's making the comment, a discussion ID that says which…

Contents