Files
Global-Jain/resources/docs/1.0/post.md
2025-11-05 10:37:10 +05:30

22 KiB

API Docs

List

Details for category list api

####Endpoint

{warning} Please note that the URI for this endpoint should include api/{$version} before

| Method | URI | Headers | | : | :- | : | | GET | /post-category-list | Default |

URL Params

None

Data Params

None

{success} Success Response

####Code 200 ####Content

{
    "status": 200,
    "success": true,
    "data": [
        {
            "id": 1,
            "parent_id": 0,
            "name": "Dharmik",
            "created_at": "2022-01-31T11:42:14.000000Z",
            "updated_at": "2022-01-31T11:42:14.000000Z"
        },
        {
            "id": 2,
            "parent_id": 0,
            "name": "Generik",
            "created_at": "2022-01-31T11:42:14.000000Z",
            "updated_at": "2022-01-31T11:42:14.000000Z"
        },
        {
            "id": 3,
            "parent_id": 0,
            "name": "Other",
            "created_at": "2022-01-31T11:42:14.000000Z",
            "updated_at": "2022-01-31T11:42:14.000000Z"
        }
    ],
    "message": "Get post catrgory successfully!"
}

List

Details for post list api

####Endpoint

{warning} Please note that the URI for this endpoint should include api/{$version} before

| Method | URI | Headers | | : | :- | : | | GET | /post | Default |

URL Params

None

Data Params

{
    "page" : "2"
}

{success} Success Response

####Code 200 ####Content

{
    "data": {
        "current_page": 1,
        "data": [
            {
                "id": 2,
                "user_id": 1,
                "category_id": 2,
                "privacy": 2,
                "status": 2,
                "description": "sadasdasda update",
                "created_by": {
                    "id": 1,
                    "name": "Admin",
                    "avatar": "",
                    "created_at": "2022-01-20T11:12:23.000000Z",
                    "updated_at": "2022-01-20T11:12:23.000000Z"
                },
                "updated_by": {
                    "id": 1,
                    "name": "Admin",
                    "avatar": "",
                    "created_at": "2022-01-20T11:12:23.000000Z",
                    "updated_at": "2022-01-20T11:12:23.000000Z"
                },
                "location": "GA",
                "created_at": "2022-02-01T08:59:57.000000Z",
                "updated_at": "2022-02-01T09:00:05.000000Z",
                "likes_count": 0,
                "tag_users": [],
                "post_images": [
                    {
                        "id": 5,
                        "post_id": 2,
                        "image_name": "http://global-jain.test/storage/images/posts/3991643708006.png",
                        "created_at": "2022-02-01T09:33:26.000000Z",
                        "updated_at": "2022-02-01T09:33:26.000000Z"
                    }
                ]
            }
        ],
        "first_page_url": "http://global-jain.test/api/v1/post?page=1",
        "from": 1,
        "last_page": 2,
        "last_page_url": "http://global-jain.test/api/v1/post?page=2",
        "links": [
            {
                "url": null,
                "label": "« Previous",
                "active": false
            },
            {
                "url": "http://global-jain.test/api/v1/post?page=1",
                "label": "1",
                "active": true
            },
            {
                "url": "http://global-jain.test/api/v1/post?page=2",
                "label": "2",
                "active": false
            },
            {
                "url": "http://global-jain.test/api/v1/post?page=2",
                "label": "Next »",
                "active": false
            }
        ],
        "next_page_url": "http://global-jain.test/api/v1/post?page=2",
        "path": "http://global-jain.test/api/v1/post",
        "per_page": 10,
        "prev_page_url": null,
        "to": 10,
        "total": 17
    },
    "status": 200
}

List

Details for user post list api

####Endpoint

{warning} Please note that the URI for this endpoint should include api/{$version} before

| Method | URI | Headers | | : | :- | : | | GET | /user/post | Default |

URL Params

None

Data Params

{
    "page" : "2"
}

{success} Success Response

####Code 200 ####Content

{
    "data": {
        "current_page": 1,
        "data": [
            {
                "id": 2,
                "user_id": 1,
                "category_id": 2,
                "privacy": 2,
                "status": 2,
                "description": "sadasdasda update",
                "created_by": {
                    "id": 1,
                    "name": "Admin",
                    "avatar": "",
                    "created_at": "2022-01-20T11:12:23.000000Z",
                    "updated_at": "2022-01-20T11:12:23.000000Z"
                },
                "updated_by": {
                    "id": 1,
                    "name": "Admin",
                    "avatar": "",
                    "created_at": "2022-01-20T11:12:23.000000Z",
                    "updated_at": "2022-01-20T11:12:23.000000Z"
                },
                "location": "GA",
                "created_at": "2022-02-01T08:59:57.000000Z",
                "updated_at": "2022-02-01T09:00:05.000000Z",
                "likes_count": 0,
                "tag_users": [],
                "post_images": [
                    {
                        "id": 5,
                        "post_id": 2,
                        "image_name": "http://global-jain.test/storage/images/posts/3991643708006.png",
                        "created_at": "2022-02-01T09:33:26.000000Z",
                        "updated_at": "2022-02-01T09:33:26.000000Z"
                    }
                ]
            }
        ],
        "first_page_url": "http://global-jain.test/api/v1/post?page=1",
        "from": 1,
        "last_page": 2,
        "last_page_url": "http://global-jain.test/api/v1/post?page=2",
        "links": [
            {
                "url": null,
                "label": "« Previous",
                "active": false
            },
            {
                "url": "http://global-jain.test/api/v1/post?page=1",
                "label": "1",
                "active": true
            },
            {
                "url": "http://global-jain.test/api/v1/post?page=2",
                "label": "2",
                "active": false
            },
            {
                "url": "http://global-jain.test/api/v1/post?page=2",
                "label": "Next »",
                "active": false
            }
        ],
        "next_page_url": "http://global-jain.test/api/v1/post?page=2",
        "path": "http://global-jain.test/api/v1/post",
        "per_page": 10,
        "prev_page_url": null,
        "to": 10,
        "total": 17
    },
    "status": 200
}

List

Details for user draft post

####Endpoint

{warning} Please note that the URI for this endpoint should include api/{$version} before

| Method | URI | Headers | | : | :- | : | | Get | /get-draft-post | Default |

URL Params

None

Data Params

None

{success} Success Response

####Code 200 ####Content

{
    "status": 200,
    "success": true,
    "data": {
        "id": 31,
        "user_id": 1,
        "category_id": 1,
        "privacy": 1,
        "status": 1,
        "description": "a",
        "created_by": {
            "id": 1,
            "name": "Admin",
            "avatar": "http://global-jain.test/images/misc/placeholder.png",
            "created_at": "2022-01-20T11:12:23.000000Z",
            "updated_at": "2022-03-02T13:34:34.000000Z",
            "is_friends": false
        },
        "updated_by": null,
        "location": "Ah",
        "type": null,
        "type_id": null,
        "created_at": "2022-03-03T04:49:19.000000Z",
        "updated_at": "2022-03-03T04:49:19.000000Z",
        "created_ago": "1 minute ago",
        "is_friends": false,
        "tag_users": [
            {
                "id": 1,
                "name": "Admin",
                "avatar": "http://global-jain.test/images/misc/placeholder.png",
                "is_friends": false,
                "pivot": {
                    "post_id": 31,
                    "user_id": 1,
                    "created_at": "2022-03-03T04:49:19.000000Z",
                    "updated_at": "2022-03-03T04:49:19.000000Z"
                }
            }
        ],
        "post_images": [],
        "category": {
            "id": 1,
            "parent_id": 0,
            "name": "Dharmik",
            "created_at": "2022-01-31T12:28:34.000000Z",
            "updated_at": "2022-01-31T12:28:34.000000Z"
        }
    },
    "message": "Get post info successfully!"
}

List

Details for add post api

####Endpoint

{warning} Please note that the URI for this endpoint should include api/{$version} before

| Method | URI | Headers | | : | :- | : | | POST | /post | Default |

URL Params

None

Data Params

description:sadasdasda
privacy:1
category_id:5 
images[0]:binary
images[1]:binary
location: Ahem
user_id[]:1
user_id[]:2
status:1
type_id:2 (id of type)
type:2 (1: User, 2: Sant, 3: Sangh)

{success} Success Response

####Code 200 ####Content

{
    "status": 200,
    "success": true,
    "data": {
        "user_id": 1,
        "created_by": {
            "id": 1,
            "name": "Admin",
            "mobile": "12",
            "created_at": "2022-01-20T11:12:23.000000Z",
            "updated_at": "2022-01-20T11:12:23.000000Z"
        },
        "privacy": "1",
        "location": "Ah",
        "category_id": "1",
        "description": "sadasdasda",
        "updated_at": "2022-02-01T08:59:57.000000Z",
        "created_at": "2022-02-01T08:59:57.000000Z",
        "likes_count": 0,
        "id": 2,
        "updated_by": null
    },
    "message": "Post added successfully!"
}

List

Details for update post api

####Endpoint

{warning} Please note that the URI for this endpoint should include api/{$version} before

| Method | URI | Headers | | : | :- | : | | POST | /post/{id} | Default |

URL Params

None

Data Params

description:sadasdasda update
privacy:2
category_id:2
removed_image_id[0]:3
removed_image_id[1]:4
removed_image_id[2]:2
removed_image_id[3]:1
images[0]:binary
images[1]:binary
location:GA
user_id[]:1
user_id[]:2
status:2

{success} Success Response

####Code 200 ####Content

{
    "status": 200,
    "success": true,
    "data": {
        "id": 2,
        "user_id": 1,
        "category_id": 2,
        "privacy": 2,
        "description": "sadasdasda update",
        "created_by": {
            "id": 1,
            "name": "Admin",
            "avatar": "",
            "created_at": "2022-01-20T11:12:23.000000Z",
            "updated_at": "2022-01-20T11:12:23.000000Z"
        },
        "updated_by": {
            "id": 1,
            "name": "Admin",
            "avatar": "",
            "created_at": "2022-01-20T11:12:23.000000Z",
            "updated_at": "2022-01-20T11:12:23.000000Z"
        },
        "location": "GA",
        "created_at": "2022-02-01T08:59:57.000000Z",
        "updated_at": "2022-02-01T09:00:05.000000Z",
        "likes_count": 0,
        "post_images": [
            {
                "id": 5,
                "post_id": 2,
                "image_name": "3991643708006.png",
                "created_at": "2022-02-01T09:33:26.000000Z",
                "updated_at": "2022-02-01T09:33:26.000000Z"
            }
        ]
    },
    "message": "Post updated successfully!"
}

List

Details for delete post api

####Endpoint

{warning} Please note that the URI for this endpoint should include api/{$version} before

| Method | URI | Headers | | : | :- | : | | DELETE | /post/{id} | Default |

URL Params

None

Data Params

None

{success} Success Response

####Code 200 ####Content

{
    "status": 200,
    "success": true,
    "message": "Post deleted successfully!"
}

List

Details for user post list api

####Endpoint

{warning} Please note that the URI for this endpoint should include api/{$version} before

| Method | URI | Headers | | : | :- | : | | GET | /post/{id} | Default |

URL Params

None

Data Params

None

{success} Success Response

####Code 200 ####Content

{
    "status": 200,
    "success": true,
    "data": {
        "id": 2,
        "user_id": 1,
        "category_id": 2,
        "privacy": 2,
        "status": 2,
        "description": "sadasdasda update",
        "created_by": 1,
        "updated_by": 1,
        "location": "GA",
        "created_at": "2022-02-01T08:59:57.000000Z",
        "updated_at": "2022-02-01T09:00:05.000000Z",
        "comments": {
            "current_page": 1,
            "data": [
                {
                    "id": 7,
                    "post_id": 2,
                    "user_id": 1,
                    "reply_id": null,
                    "comment": "my comment for post  3",
                    "created_at": "2022-02-07T09:43:44.000000Z",
                    "updated_at": "2022-02-07T09:43:44.000000Z",
                    "replies": [
                        {
                            "id": 8,
                            "post_id": 2,
                            "user_id": 1,
                            "reply_id": 7,
                            "comment": "my comment for post reply 2 update for id 2",
                            "created_at": "2022-02-07T09:44:00.000000Z",
                            "updated_at": "2022-02-07T10:02:53.000000Z"
                        }
                    ]
                },
                {
                    "id": 5,
                    "post_id": 2,
                    "user_id": 1,
                    "reply_id": null,
                    "comment": "my comment for post reply 2 update",
                    "created_at": "2022-02-03T12:04:12.000000Z",
                    "updated_at": "2022-02-04T06:11:00.000000Z",
                    "replies": []
                },
                {
                    "id": 4,
                    "post_id": 2,
                    "user_id": 1,
                    "reply_id": null,
                    "comment": "my comment for post reply 2 update",
                    "created_at": "2022-02-03T12:04:00.000000Z",
                    "updated_at": "2022-02-04T06:11:00.000000Z",
                    "replies": []
                },
                {
                    "id": 3,
                    "post_id": 2,
                    "user_id": 1,
                    "reply_id": null,
                    "comment": "my comment for post reply 2 update",
                    "created_at": "2022-02-03T12:03:27.000000Z",
                    "updated_at": "2022-02-04T06:11:00.000000Z",
                    "replies": []
                },
                {
                    "id": 2,
                    "post_id": 2,
                    "user_id": 1,
                    "reply_id": null,
                    "comment": "my comment for post reply 2 update for id 2",
                    "created_at": "2022-02-03T12:03:22.000000Z",
                    "updated_at": "2022-02-04T06:14:04.000000Z",
                    "replies": []
                }
            ],
            "first_page_url": "http://global-jain.test/api/v1/post/2?page=1",
            "from": 1,
            "last_page": 2,
            "last_page_url": "http://global-jain.test/api/v1/post/2?page=2",
            "links": [
                {
                    "url": null,
                    "label": "« Previous",
                    "active": false
                },
                {
                    "url": "http://global-jain.test/api/v1/post/2?page=1",
                    "label": "1",
                    "active": true
                },
                {
                    "url": "http://global-jain.test/api/v1/post/2?page=2",
                    "label": "2",
                    "active": false
                },
                {
                    "url": "http://global-jain.test/api/v1/post/2?page=2",
                    "label": "Next »",
                    "active": false
                }
            ],
            "next_page_url": "http://global-jain.test/api/v1/post/2?page=2",
            "path": "http://global-jain.test/api/v1/post/2",
            "per_page": 5,
            "prev_page_url": null,
            "to": 5,
            "total": 6
        }
    },
    "message": "Get post info successfully!"
}

List

Details for delete post api

####Endpoint

{warning} Please note that the URI for this endpoint should include api/{$version} before

| Method | URI | Headers | | : | :- | : | | POST | /post/like | Default |

URL Params

None

Data Params

post_id : 2

{success} Success Response

####Code 200 ####Content

{
    "status": 200,
    "success": true,
    "message": "Post disliked successfully!"
}

List

Details for add comment in post api

####Endpoint

{warning} Please note that the URI for this endpoint should include api/{$version} before

| Method | URI | Headers | | : | :- | : | | POST | /post/add-comment | Default |

URL Params

None

Data Params

post_id:2
comment:my comment for post  3
reply_id:

{success} Success Response

####Code 200 ####Content

{
    "status": 200,
    "success": true,
    "message": "Comment added successfully!"
}

List

Details for update comment in post api

####Endpoint

{warning} Please note that the URI for this endpoint should include api/{$version} before

| Method | URI | Headers | | : | :- | : | | POST | /post/update-comment | Default |

URL Params

None

Data Params

comment:'my comment for post reply 2 update for id 2'
comment_id:8
post_id:2

{success} Success Response

####Code 200 ####Content

{
    "status": 200,
    "success": true,
    "message": "Comment updated successfully!"
}

List

Details for delete post api

####Endpoint

{warning} Please note that the URI for this endpoint should include api/{$version} before

| Method | URI | Headers | | : | :- | : | | POST | /post/remove-comment | Default |

URL Params

None

Data Params

comment_id : 2

{success} Success Response

####Code 200 ####Content

{
    "status": 200,
    "success": true,
    "message": "Comment deleted successfully!"
}

{danger} Unauthenticated Response

####Code 403 ####Content

{
    "message": "Something went wrong!"
}

List

Details for post list api

####Endpoint

{warning} Please note that the URI for this endpoint should include api/{$version} before

| Method | URI | Headers | | : | :- | : | | POST | post/{post}/comments | Default |

URL Params

None

Data Params

{
    "page" : "2"
}

{success} Success Response

####Code 200 ####Content

{
    "status": 200,
    "success": true,
    "data": {
        "current_page": 1,
        "data": [
            {
                "id": 1,
                "post_id": 2,
                "user_id": 2,
                "reply_id": null,
                "comment": "my comment for post reply 2 update for id 1",
                "created_at": "2022-02-03T12:02:57.000000Z",
                "updated_at": "2022-02-04T06:13:45.000000Z",
                "is_edited": false
            },
            {
                "id": 2,
                "post_id": 2,
                "user_id": 1,
                "reply_id": null,
                "comment": "my comment for post reply 2 update for id 2",
                "created_at": "2022-02-03T12:03:22.000000Z",
                "updated_at": "2022-02-04T06:14:04.000000Z",
                "is_edited": true
            },
        ],
        "first_page_url": "http://global-jain.test/api/v1/post/4/comments?page=1",
        "from": null,
        "last_page": 1,
        "last_page_url": "http://global-jain.test/api/v1/post/4/comments?page=1",
        "links": [
            {
                "url": null,
                "label": "« Previous",
                "active": false
            },
            {
                "url": "http://global-jain.test/api/v1/post/4/comments?page=1",
                "label": "1",
                "active": true
            },
            {
                "url": null,
                "label": "Next »",
                "active": false
            }
        ],
        "next_page_url": null,
        "path": "http://global-jain.test/api/v1/post/4/comments",
        "per_page": 10,
        "prev_page_url": null,
        "to": null,
        "total": 0
    },
    "message": "Get comments successfully!"
}

Hide post

Details for hide post api

####Endpoint

{warning} Please note that the URI for this endpoint should include api/{$version} before

| Method | URI | Headers | | : | :- | : | | POST | /user/hide-post | Bearer {token} |

URL Params

None

Data Params

{
    "id": 7,
    "status": 0 // 0: Unhide, 1: Hide
}

{success} Success Response

####Code 200 ####Content

{
    "message": "Post is hidden!",
    "status": 200,
}

{danger} Unauthenticated Response

####Code 403 ####Content

{
    "message": "Something went wrong!",
    "status": 403
}