Skip to content

Community

List Posts

Endpoint: GET /community/posts/list

Description: List all posts in the community.

Query Parameters: - page (integer): Page number - per_page (integer): Number of items per page - cursor (string): Cursor for pagination

Response: 200 OK

{
    "posts": [
        {
            "id": "post_uuid",
            "user_id": "user_uuid",
            "user": {
                "id": "user_uuid",
                "full_name": "Jane Doe",
                "profile": {
                    "avatar_url": "https://example.com/avatar.jpg"
                }
            },
            "title": "My First Post",
            "content": "This is my first post in the community!",
            "created_at": "2025-11-18T21:30:45.123456",
            "views": 10,
            "photos": [],
            "comments": [],
            "likes_count": 5,
            "comments_count": 2,
            "is_liked": false,
            "is_approved": true
        }
    ],
    "meta": {
        "page": 1,
        "per_page": 20,
        "total": 1,
        "total_pages": 1,
        "next_cursor": null
    }
}

View Post

Endpoint: GET /community/posts/{post_id}

Description: View a single post.

Response: 200 OK

{
    "id": "post_uuid",
    "user_id": "user_uuid",
    "user": {
        "id": "user_uuid",
        "full_name": "Jane Doe",
        "profile": {
            "avatar_url": "https://example.com/avatar.jpg"
        }
    },
    "title": "My First Post",
    "content": "This is my first post in the community!",
    "created_at": "2025-11-18T21:30:45.123456",
    "views": 10,
    "photos": [],
    "comments": [],
    "likes_count": 5,
    "comments_count": 2,
    "is_liked": false,
    "is_approved": true
}

Toggle Like

Endpoint: POST /community/posts/{post_id}/like

Description: Toggle a like on a post.

Response: 200 OK

{
    "is_liked": true,
    "likes_count": 6
}

Create Post

Endpoint: POST /community/posts/

Description: Create a new post.

Request Body:

{
    "title": "My First Post",
    "content": "This is my first post in the community!",
    "photo_ids": []
}

Response: 201 Created

{
    "id": "post_uuid",
    "user_id": "user_uuid",
    "user": {
        "id": "user_uuid",
        "full_name": "Jane Doe",
        "profile": {
            "avatar_url": "https://example.com/avatar.jpg"
        }
    },
    "title": "My First Post",
    "content": "This is my first post in the community!",
    "created_at": "2025-11-18T21:30:45.123456",
    "views": 0,
    "photos": [],
    "comments": [],
    "likes_count": 0,
    "comments_count": 0,
    "is_liked": false,
    "is_approved": true
}

Create Post with Upload

Endpoint: POST /community/posts/upload

Description: Create a new post with file uploads.

Request Body: multipart/form-data with title, content, and files fields.

Response: 201 Created

{
    "id": "post_uuid",
    "user_id": "user_uuid",
    "user": {
        "id": "user_uuid",
        "full_name": "Jane Doe",
        "profile": {
            "avatar_url": "https://example.com/avatar.jpg"
        }
    },
    "title": "My First Post",
    "content": "This is my first post in the community!",
    "created_at": "2025-11-18T21:30:45.123456",
    "views": 0,
    "photos": [
        {
            "id": "photo_uuid",
            "url": "https://nora.s3.amazonaws.com/community/post_uuid/photo.jpg"
        }
    ],
    "comments": [],
    "likes_count": 0,
    "comments_count": 0,
    "is_liked": false,
    "is_approved": true
}

Add Comment

Endpoint: POST /community/posts/{post_id}/comment

Description: Add a comment to a post.

Request Body:

{
    "comment": "This is a great post!"
}

Response: 201 Created

{
    "id": "comment_uuid",
    "comment": "This is a great post!"
}

Delete Post

Endpoint: DELETE /community/posts/{post_id}

Description: Delete a post.

Response: 204 No Content

Update Comment

Endpoint: PUT /community/posts/comments/{comment_id}

Description: Edit an existing comment.

Request Body:

{
    "comment": "This is an updated comment."
}

Response: 200 OK

{
    "id": "comment_uuid",
    "comment": "This is an updated comment."
}

Delete Comment

Endpoint: DELETE /community/posts/comments/{comment_id}

Description: Delete a comment.

Response: 204 No Content

Get Posts by User

Endpoint: GET /community/posts/user/{user_id}

Description: Get all posts by a specific user.

Query Parameters: - page (integer): Page number - per_page (integer): Number of items per page

Response: 200 OK

{
    "posts": [
        {
            "id": "post_uuid",
            "user_id": "user_uuid",
            "user": {
                "id": "user_uuid",
                "full_name": "Jane Doe",
                "profile": {
                    "avatar_url": "https://example.com/avatar.jpg"
                }
            },
            "title": "My First Post",
            "content": "This is my first post in the community!",
            "created_at": "2025-11-18T21:30:45.123456",
            "views": 10,
            "photos": [],
            "comments": [],
            "likes_count": 5,
            "comments_count": 2,
            "is_liked": false,
            "is_approved": true
        }
    ],
    "meta": {
        "page": 1,
        "per_page": 20,
        "total": 1,
        "total_pages": 1,
        "next_cursor": null
    }
}