-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi_example.txt
More file actions
49 lines (46 loc) · 1003 Bytes
/
api_example.txt
File metadata and controls
49 lines (46 loc) · 1003 Bytes
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
1.newTopic()
- request:
- url: "/newtopic"
- method: post
- params: [title: string]
- response:
- format: json
- example:
{
"status" : "true"
}
2.getTopics()
- request:
- url: "/topics"
- response:
- format: json
- example:
{
"length" : "10",
"order" : "desc",
"items" : [
{
"id" : "1", // topic id is unique
"title" : "hello world",
"votes" : "3"
},
{
"id" : "2",
"title" : "I like Carousell",
"votes" : "99"
}
]
}
3.voteById()
- request:
- url: "/votes"
- method: get
- params: [id: number, type: number] // type's value is either 1 or -1, 1 for upvote, -1 for downvote
- response:
- format: json
- example:
{
"id" : "1", // topic id
"status" : "true"
}
[{"id" : "2","title" : "I like Carousell","votes" : "99"}]