Mock Single Resource Detail Response

Generate a mock JSON response for a single resource detail endpoint. Ideal for testing GET /resource/:id views with all fields populated.

REST Responses

Detailed Explanation

Single Resource Detail

A detail endpoint returns a single object rather than an array. This is the response you get from GET /api/users/:id or GET /api/products/:id. The response is a bare object without array wrapping.

Schema Structure

{
  "id": "uuid",
  "name": "string",
  "email": "email",
  "bio": "string (nullable)",
  "avatarUrl": "url (nullable)",
  "role": "enum(admin,user,moderator)",
  "isVerified": "boolean",
  "lastLoginAt": "date (nullable)",
  "createdAt": "date",
  "updatedAt": "date"
}

Bare vs Wrapped Response

For single-resource endpoints, many APIs return the object directly without a data wrapper. This is simpler and reduces nesting. However, wrapping in { "data": {...} } is also common as it provides consistency with list endpoints and leaves room for metadata like _links in HATEOAS patterns.

Nullable Fields

The bio, avatarUrl, and lastLoginAt fields are configured with nullable probability. This tests how your UI handles missing optional data — a common source of runtime errors if not handled properly. Always provide fallback values or conditional rendering for nullable fields.

Timestamp Fields

Including both createdAt and updatedAt is a best practice. It enables "last modified" displays and conditional caching with If-Modified-Since headers.

Use Case

Developers building a user profile page or product detail view can use this mock to ensure their UI correctly renders all fields, handles null values gracefully, and displays timestamps in the user's locale.

Try It — API Response Mocker

Open full tool