API Development cheatsheet
Syntax snippets and quick notes for revision.
API Basics
// API Specification for API Basics
{
"route": "/api/v1/api-basics",
"method": "POST",
"contentType": "application/json",
"response200": { "success": true }
}Use this api basics pattern when a API Development task needs a small, readable starting point.
HTTP Protocols and Methods
// REST API Payload GET /api/v1/orders?status=paid&limit=10 Host: api.ankuaitools.com Authorization: Bearer jwt_token_here Accept: application/json
Use this http protocols and methods pattern when a API Development task needs a small, readable starting point.
REST Architecture Guidelines
// REST API Payload GET /api/v1/orders?status=paid&limit=10 Host: api.ankuaitools.com Authorization: Bearer jwt_token_here Accept: application/json
Use this rest architecture guidelines pattern when a API Development task needs a small, readable starting point.
URL Path Design
// API Specification for URL Path Design
{
"route": "/api/v1/url-path-design",
"method": "POST",
"contentType": "application/json",
"response200": { "success": true }
}Use this url path design pattern when a API Development task needs a small, readable starting point.
Request Headers
// API Specification for Request Headers
{
"route": "/api/v1/request-headers",
"method": "POST",
"contentType": "application/json",
"response200": { "success": true }
}Use this request headers pattern when a API Development task needs a small, readable starting point.
Response Status Codes
// API Specification for Response Status Codes
{
"route": "/api/v1/response-status-codes",
"method": "POST",
"contentType": "application/json",
"response200": { "success": true }
}Use this response status codes pattern when a API Development task needs a small, readable starting point.
JSON Payload Format
{
"id": 42,
"total": 56,
"status": "paid",
"customer": "Asha",
"items": [{ "sku": "key-01", "qty": 1 }]
}Use this json payload format pattern when a API Development task needs a small, readable starting point.
Query Parameters
// API Specification for Query Parameters
{
"route": "/api/v1/query-parameters",
"method": "POST",
"contentType": "application/json",
"response200": { "success": true }
}Use this query parameters pattern when a API Development task needs a small, readable starting point.
Pagination Patterns
// API Specification for Pagination Patterns
{
"route": "/api/v1/pagination-patterns",
"method": "POST",
"contentType": "application/json",
"response200": { "success": true }
}Use this pagination patterns pattern when a API Development task needs a small, readable starting point.
Filtering and Sorting APIs
// API Specification for Filtering and Sorting APIs
{
"route": "/api/v1/filtering-and-sorting-apis",
"method": "POST",
"contentType": "application/json",
"response200": { "success": true }
}Use this filtering and sorting apis pattern when a API Development task needs a small, readable starting point.
Authentication Options
// API Specification for Authentication Options
{
"route": "/api/v1/authentication-options",
"method": "POST",
"contentType": "application/json",
"response200": { "success": true }
}Use this authentication options pattern when a API Development task needs a small, readable starting point.
API Keys Security
// API Specification for API Keys Security
{
"route": "/api/v1/api-keys-security",
"method": "POST",
"contentType": "application/json",
"response200": { "success": true }
}Use this api keys security pattern when a API Development task needs a small, readable starting point.