News

Get all the posts

Type: GET
Route: /posts
1
2

Response 200

{
	"message": "Successfully retrieved posts.",
	"posts": [
		{
			"id": 1,
			"type": 1,
			"slug": "some-slug",
			"title": "some-title",
			"content": "some-content",
			"createdAt": "1970-01-01T00:00:00.000Z",
			"editedAt": "1970-01-01T00:00:00.000Z",
			"user": {
				"uuid": "345c45aa-5h76-9zh4-6tr7-6tkl52rn5783",
				"username": "testuser",
				"displayName": "TestUser",
				"avatarImage": "testuser-512x512.jpg"
			}
		},
		...
	]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

Get a specific post

Type: GET
Route: /posts/{slug}
1
2

URI Parameters

Name: slug
Type: String
Required: True
1
2
3

Response 200

{
	"message": "Successfully retrieved post.",
	"post": [
		{
			"id": 1,
			"type": 1,
			"slug": "some-slug",
			"title": "some-title",
			"content": "some-content",
			"createdAt": "1970-01-01T00:00:00.000Z",
			"editedAt": "1970-01-01T00:00:00.000Z",
			"user": {
				"uuid": "345c45aa-5h76-9zh4-6tr7-6tkl52rn5783",
				"username": "testuser",
				"displayName": "TestUser",
				"avatarImage": "testuser-512x512.jpg"
			},
			"comments": [
				"id": 1,
				"parentId": 0,
				"content": "some-content",
				"createdAt": "1970-01-01T00:00:00.000Z",
				"editedAt": "1970-01-01T00:00:00.000Z",
				"user": {
					"uuid": "345c45aa-5h76-9zh4-6tr7-6tkl52rn5783",
					"username": "testuser",
					"displayName": "TestUser",
					"avatarImage": "testuser-512x512.jpg"
				},
				...
			]
		},
		...
	]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

Possible errors

# Code 400
{ "message": "No params provided." }
{ "message": "Invalid params provided." }

# Code 404
{ "message": "No post found." }
1
2
3
4
5
6

Post a new comment

Type: POST
Route: /posts/{id}/comments
1
2

URI Parameters

Name: id
Type: String
Required: True
1
2
3

Body

{
	"parentId": 0,
	"content": "Your comment."
}
1
2
3
4

Response 200

{
	"message": "Successfully commented on the post",
	"comment": {
		"id": 1,
		"parentId": 0,
		"content": "some-content",
		"createdAt": "1970-01-01T00:00:00.000Z",
		"editedAt": "1970-01-01T00:00:00.000Z",
		"user": {
		"uuid": "345c45aa-5h76-9zh4-6tr7-6tkl52rn5783",
		"username": "testuser",
		"displayName": "TestUser",
		"avatarImage": "testuser-512x512.jpg"
		}
	}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

Possible errors

# Code 400
{ "message": "No params provided." }
{ "message": "Invalid params provided." }
{ "message": "No body provided." }
{ "message": "Invalid body provided." }

# Code 404
{ "message": "No comment found." }
{ "message": "No post found." }
1
2
3
4
5
6
7
8
9

Get comments on a post

Type: GET
Route: /posts/{id}/comments
1
2

URI Parameters

Name: id
Type: String
Required: True
1
2
3

Response 200

{
	"message": "Successfully retrieved comments.",
	"comments": [
		{
			"id": 1,
			"parentId": 0,
			"content": "some-content",
			"createdAt": "1970-01-01T00:00:00.000Z",
			"editedAt": "1970-01-01T00:00:00.000Z",
			"user": {
				"uuid": "345c45aa-5h76-9zh4-6tr7-6tkl52rn5783",
				"username": "testuser",
				"displayName": "TestUser",
				"avatarImage": "testuser-512x512.jpg"
			}
		},
		...
	]
}
# or
{
	"message": "No comments found.",
	"comments": []
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

Possible errors

# Code 400
{ "message": "No params provided." }
{ "message": "Invalid params provided." }

# Code 404
{ "message": "No post found." }
1
2
3
4
5
6
Last Updated: 6/21/2018, 9:06:02 PM