This repository has been archived by the owner on Nov 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathapiary.apib
80 lines (53 loc) · 1.97 KB
/
apiary.apib
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
FORMAT: 1A
HOST: http://polls.apiblueprint.org/
# Polls
Polls is a simple API allowing consumers to view polls and vote in them.
## Group Question
Resources related to questions in the API.
## Question [/questions/{question_id}]
+ Parameters
+ question_id (required, number, `1`) ... ID of the Question in form of an integer
+ Attributes
+ question: `Favourite programming language?` (string, required)
+ published_at: `2014-11-11T08:40:51.620Z` (string) - An ISO8601 date when the question was published
+ choices (array[Choice], required) - An array of Choice objects
+ url: /questions/1 (string)
### View a Questions Detail [GET]
+ Response 200 (application/json)
+ Attributes (Question)
### Delete a Question [DELETE]
+ Relation: delete
+ Response 204
## Choice [/questions/{question_id}/choices/{choice_id}]
+ Parameters
+ question_id (required, number, `1`) ... ID of the Question in form of an integer
+ choice_id (required, number, `1`) ... ID of the Choice in form of an integer
+ Attributes
+ choice: Swift (string, required)
+ votes: 0 (number, required)
### Vote on a Choice [POST]
This action allows you to vote on a question's choice.
+ Relation: vote
+ Response 201
+ Headers
Location: /questions/1
## Questions Collection [/questions{?page}]
+ Parameters
+ page (optional, number, `1`) ... The page of questions to return
+ Attributes (array[Question])
### List All Questions [GET]
+ Relation: questions
+ Response 200 (application/json)
+ Headers
Link: </questions?page=2>; rel="next"
+ Attributes (array[Question])
### Create a New Question [POST]
You may create your own question using this action. It takes a JSON
object containing a question and a collection of answers in the
form of choices.
+ Relation: create
+ Attributes
+ question (string, required) - The question
+ choices (array[string]) - A collection of choices.
+ Response 201 (application/json)
+ Attributes (Question)