Skip to content

Backend API Post

Nhan Nguyen edited this page Mar 5, 2021 · 9 revisions

Post

/service/author/{AUTHOR_ID}/posts/{POST_ID} will get you the post of that author with the 5 most recent comments

  • Request Method: GET
  • Example Response

    "type": "post",
    "title": "goat post lebron",
    "id": "ec46af16-4a8c-403e-91c7-e6a6860bbcc6",
    "source": "localhost:8000/some_random_source",
    "origin": "local host:9900",
    "description": "aruso is the goat",
    "contentType": "text/plain",
    "content": "first post with new API",
    "author": {
        "type": "author",
        "id": "d1df0f23-cd4f-4875-b79b-dca706093b89",
        "host": "http://localhost:8000/",
        "displayName": "goatjames",
        "url": "somerandomUrl for now",
        "github": ""
    },
    "categories": [
        "fitness,",
        "travel,",
        "compscience"
    ],
    "count": 2,
    "comments": [
        {
            "type": "comment",
            "author": {
                "type": "author",
                "id": "d1df0f23-cd4f-4875-b79b-dca706093b89",
                "host": "http://localhost:8000/",
                "displayName": "goatjames",
                "url": "somerandomUrl for now",
                "github": ""
            },
            "comment": "nice weather",
            "contentType": "text/markdown",
            "published": "2021-03-03T00:23:11.783Z",
            "id": "fe7ffefe-0920-4728-aec2-4ad123272f12"
        },
        {
            "type": "comment",
            "author": {
                "type": "author",
                "id": "d1df0f23-cd4f-4875-b79b-dca706093b89",
                "host": "http://localhost:8000/",
                "displayName": "goatjames",
                "url": "somerandomUrl for now",
                "github": ""
            },
            "comment": "what's good bro",
            "contentType": "text/markdown",
            "published": "2021-03-03T00:22:55.689Z",
            "id": "fe7ffefe-0920-4728-aec2-4ad123272f11"
        }
    ],
    "published": "2021-03-03T00:16:35.719Z",
    "visibility": "PUBLIC",
    "unlisted": "false"
}

POST Requests:

URL: ://service/author/{AUTHOR_ID}/posts/{POST_ID=null} will create the post for that author.

POST Body:

{
    "title": "second post",
    "description": "description of the second post -> caruso is the goat",
    "categories": "fitness, travel, compsci",
    "content": "long detailed content of the post",
    "origin": "local host:9900"
}

PUT Requests:

URL: ://service/author/{AUTHOR_ID}/posts/{POST_ID} PUT Body:

{
    "title": "goat post",
    "description": "Caruso is the goat",
    "categories": "fitness, travel, compsci",
    "content": "first post with new API",
    "origin": "local host:9900",
    "visibility": PUBLIC
    "shared_with": ""
}

DELETE Requests:

URL: ://service/author/{AUTHOR_ID}/posts/{POST_ID} -> this will delete the post with the id you provided.


Clone this wiki locally