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?