Skip to content

Request and Response Models

Subhrodip Mohanta edited this page Apr 3, 2026 · 4 revisions

Request and Response Models

This page defines the core data contracts for the Moo API. All paginated responses follow the standard Spring Data Page structure.

Core Models

User

{
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "username": "string",
  "name": "string",
  "avatar": "string",
  "bio": "string",
  "followerCount": 0,
  "followingCount": 0,
  "verified": true
}

Post

{
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "text": "string",
  "userId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "images": ["string"],
  "repostCount": 0,
  "likeCount": 0,
  "hashtags": ["string"],
  "mentions": ["string"],
  "originalPostId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "replyToId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "timestamp": "2021-06-26T19:32:31.744Z"
}

Hashtag

{
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "tag": "string",
  "recentPostCount": 0
}

Paginated Response Wrapper (Spring Page)

Endpoints marked with 📃 return this structure:

{
  "content": [ ... ],
  "pageable": {
    "sort": { "empty": false, "sorted": true, "unsorted": false },
    "offset": 0,
    "pageNumber": 0,
    "pageSize": 10,
    "paged": true,
    "unpaged": false
  },
  "last": true,
  "totalElements": 45,
  "totalPages": 5,
  "size": 10,
  "number": 0,
  "first": true,
  "numberOfElements": 10,
  "empty": false
}

Application Error Response

When a request fails, the API returns a robust error object:

{
  "timestamp": "2026-04-04T00:00:00.000+00:00",
  "status": 400,
  "error": "Bad Request",
  "cause": "Specific details about what went wrong",
  "path": "/api/endpoint"
}

Clone this wiki locally