Skip to content

Instantly share code, notes, and snippets.

@robbyronk
Created April 21, 2020 23:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robbyronk/c9db2c7e3416e0a4e5d679803eba4498 to your computer and use it in GitHub Desktop.
Save robbyronk/c9db2c7e3416e0a4e5d679803eba4498 to your computer and use it in GitHub Desktop.
Sample HTTP API Documentation

Simple lightweight API descriptions prevent misunderstanding.

Add emoji symbols to help guide people's eyes when scanning the docs.

User Endpoints

PATCH /user/:id

Updates a user.

✨ Request:

PATCH /user/3

{
  "username": "jsmith"
}

🆗 Response:

{
  "id": 3,
  "username": "jsmith"
}

💥 Unauthorised Response:

403 Forbidden

{
  "unauthorised": true,
  "message": "You are not permitted to update the username field on the user with id 3."
}

📡 Websocket Example

URL: wss://example.com/socket

Session Messages

✨ Log in request:

{
  "username": "example",
  "password": "Password1"
}

🆗 Response:

{
  "username": "example",
  "session_expiry": "2019-01-01T00:00:00",
  "refresh_token": "abc123"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment