documentation
documentation copied to clipboard
API reference reformatting
Based on this discussion, we want to standardize and reformat the API references.
Possible template
- A brief introduction + description
- Link to guide
- List endpoints: (possible order)
- List all
- List one
- Create
- Update
- Delete all
- Delete one
- For each endpoint (the following do not apply to all endpoints):
- What it does
-
<RouteHighlighter>
element- Its convention to put path variables in {} in endpoints. But I see a lot of documentation without it as well
- Path variables
- Use a table with the name, type, description columns
- Query parameters
- Use a table with the name, type, description, default value (optional) columns
- Fields returned
- Use a table with the name, type, description columns
- What would nested objects look like?
- Request body
- Use a table with the name, type, description columns
- JSON sample
- Example
- Code sample
- Response
- Add a short description if needed
- Can we do this for each response? I think this will be a lot more helpful compared to the current errors page that we have. We can’t cover everything but maybe the major ones?
- Possible problems: May get too long
Questions:
- Should path variables be in bold or back ticks? index_uid or
index_uid
? - Are there any parameters that have a max/min value?
Hello,
I have created a PR for this. It's not a template, it's more of a visual reference for what we want our template to include. I also think we need colors. I love Spotify's API reference, it doesn’t have too many colors. I like what I have for the pages called: POST, PUT, PATCH, and DELETE. If anyone has any suggestions, please lmk! The pages called: GET visual reference 1 and GET visual reference 2 have different formats.
GET visual reference 1
There's 2 headings with the same format, I used two to see what the page would look like for an object with fewer fields vs. more fields. I used a table for explaining the fields returned.
Pros
Its a table. Tables look super organized, the user will be able to view all the information without having to scroll too much.
Cons
The table is ugly. I don’t like how the code snippets overlap.
GET visual reference 2
This format starts of with the object like Stripe and does not use a table for explaining the fields returned. This means not all H2s will be an endpoint. I used two to see what the page would look like for an object with fewer fields vs. more fields.
I like MailChimp's API reference, they don’t use tables.
Pros
No tables!
Cons
- Goes against our convention of H2=endpoints. I personally don’t think it's that big of a problem if we're consistent with it and it works. Currently we have two examples where we're explaining the returned fields:
- Stats and keys (part of v025): I don’t like it because we explain some fields in one endpoint and some in the other. This means the user will have to scroll between them to get the complete information
- Tasks (part of v025): The tasks object is explained on a different page
- The fields part can get long so the user may have to scroll between the fields We could also use what we have in GET visual reference 1 without tables and GET visual reference 2 with tables.
We will start with:
- https://github.com/meilisearch/documentation/issues/1526
- https://github.com/meilisearch/documentation/issues/1527
- https://github.com/meilisearch/documentation/issues/1528
Update pages to add sidebarDepth: 2
, make all Example, Query parameter, body subsections, etc. headings H4 so any other things that aren't endpoints (e.g., object definitions, special subsections like filtering or pagination above) are more visible
fixed in the API reference PRs