Response Structure
Understand moclojer response structure - status codes, headers, body formats, and templates. Create consistent, well-structured API responses.
Learn how to structure responses in moclojer for consistent, professional APIs.
π Response Components
Complete Structure
- endpoint:
method: GET
path: /users/:id
response:
status: 200 # HTTP status code
headers: # Response headers
Content-Type: application/json
X-Custom-Header: value
body: > # Response body
{
"id": {{path-params.id}},
"name": "User"
}π― Status Codes
Success (2xx)
Client Errors (4xx)
Server Errors (5xx)
π€ Body Formats
JSON (Most Common)
Plain Text
XML
β
Best Practices
Consistent Format
Error Responses
π See Also
Last updated
Was this helpful?