-
Notifications
You must be signed in to change notification settings - Fork 0
/
apiary.apib
108 lines (80 loc) · 3.04 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
FORMAT: 1A
HOST: https://www.makeuponus/api/v1
# Makeup On Us
Polls is a simple API allowing consumers to view polls and vote in them.
## Authentication [/auth/token?client_id={client_id}&client_secret={client_secret}&username={username}&password={password}&grant_type=password]
**Makeup On Us** uses an OAuth2 based authentication, in order to sign the request, you should get an **access_token**, it should be queried using the following call:
### Request Access Token [POST]
+ Parameters
+ client_id (string, required) - Client ID as given at signup
+ client_secret (string, required) - Client Secret as given at signup
+ username (string, required) - Makeup On Us partner username
+ password (string, required) - Password
+ Response 200 (application/json)
+ Body
{
"access_token": "EVTVP1xDb8jvmJzvChHRKPlsXEgoBf",
"token_type": "Bearer",
"expires_in": 36000,
"refresh_token": "dV35FIgQyb99C6StzD5LLr9Bt90Y5q",
"scope": "read write"
}
## Products Collection [/products]
### List All Products [GET]
Query all products that belongs to your account and application.
+ Request
+ Headers
Authorization: Bearer access_token
+ Response 200 (application/json)
+ Body
[
{
"question": "Favourite programming language?",
"published_at": "2015-08-05T08:40:51.620Z",
"choices": [
{
"choice": "Swift",
"votes": 2048
}, {
"choice": "Python",
"votes": 1024
}, {
"choice": "Objective-C",
"votes": 512
}, {
"choice": "Ruby",
"votes": 256
}
]
}
]
### Create a New Product [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.
+ Request
+ Headers
Authorization: Bearer access_token
+ Response 201 (application/json)
+ Headers
Location: /questions/2
+ Body
{
"question": "Favourite programming language?",
"published_at": "2015-08-05T08:40:51.620Z",
"choices": [
{
"choice": "Swift",
"votes": 0
}, {
"choice": "Python",
"votes": 0
}, {
"choice": "Objective-C",
"votes": 0
}, {
"choice": "Ruby",
"votes": 0
}
]
}