Skip to content

Instantly share code, notes, and snippets.

@ConceptCodes
Created March 16, 2023 08:11
Show Gist options
  • Save ConceptCodes/dc128903e7cc8017c0e73500133566bf to your computer and use it in GitHub Desktop.
Save ConceptCodes/dc128903e7cc8017c0e73500133566bf to your computer and use it in GitHub Desktop.

API Documentation: [Endpoint Title]

Endpoint: [HTTP Method] /api/v1/[resource]

Point of Contact(s)

  • Developer
  • Developer

Description

A brief description of the purpose of this endpoint, such as what resources it interacts with, and what actions it performs.

Request


Headers

Header Name Required Description Example Value
Content-Type Yes The content type of the request body. Typically application/json. application/json
Authorization No The authorization token, if required for this endpoint. Bearer [Access-Token]

Path Parameters (If Needed)

Parameter Name Required Description Type Example Value
[parameter] Yes/No Description of the parameter, and any constraints on its value. String example

Query Parameters (If Needed)

Parameter Name Required Description Type Example Value
[parameter] Yes/No Description of the parameter, and any constraints on its value. String example

Request Body (JSON)

{
  "[field1]": {
    "type": "[data-type]",
    "description": "Description of the field, and any constraints on its value.",
    "required": true/false,
    "example": "example value"
  },
  "[field2]": {
    "type": "[data-type]",
    "description": "Description of the field, and any constraints on its value.",
    "required": true/false,
    "example": "example value"
  }
}

Success Response

  • Code: 200 OK
  • Content:
{
 "data": {
   "field1": "type",
   "field2": "type",
   "field3": {
     "nestedField1": "type",
     "nestedField2": "type"
   }
 },
 "status": "success",
 "message": "Your success message"
}

Error Response

  • Code: 400 BAD_REQUEST
  • Content:
{
 "error": {
   "code": "ERROR_CODE",
   "message": "A description of the error"
 },
 "status": "error"
}

Example Request

curl -X $HTTP_METHOD$ \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "field1": "value", "field2": "value", "field3": { "nestedField1": "value", "nestedField2": "value" } }' \ "$API_BASE_URL$/YOUR_ENDPOINT_NAME"

Notes

Here is where you can jot down some notes or trouble shooting guide

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment