Login | Sign Up
  • FA
  • EN

API Docs

GET /api/v1/posts

Retrieves a list of posts, with support for filtering by profile type, profile ID, search, and order.


Permissions

PermissionDescription
posts.viewView your own posts and posts on any public profile
posts.view_allView all posts, including drafts, on any profile (admin only)

Query Parameters

NameTypeRequiredDescriptionExample
typestringNoProfile type (App\Models\Gym, App\Models\User). Comma-separated for multiple"App\Models\Gym,App\Models\User"
item_idintNoProfile ID(s) to filter by (comma-separated for multiple)"1,2,3"
searchstringNoSearch term for post title or content"workout"
orderstringNoOrder of results: ASC or DESC (default: DESC)"DESC"

Response

200 OK

Returns a paginated list of post resources.

{
  "data": [
    {
      "id": 123,
      "profile_type": "App\\Models\\User",
      "profile_id": 42,
      "title": "My Workout",
      "content": "Today I did squats and deadlifts.",
      "is_draft": false,
      "media": [
        {
          "id": 10,
          "attachable_type": "App\\Models\\Posts\\Post",
          "attachable_id": 123,
          "link": "https://example.com/media/10.jpg"
        }
      ]
    }
  ],
  "links": { /* pagination data */ },
  "meta": { /* pagination data */ }
}

See Post Resource and Pagination Data (per page: 30).


Error Responses

StatusDescriptionReference
401UnauthorizedAuthentication error
403Forbidden (no permission)Permission error
404Not foundNot-found error
footer wave
logo

Dambel, the smart world of fitness and nutrition

LinkedinInstagramXYoutubeTelegramGitHub