-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpingroll.apib
175 lines (114 loc) Β· 3.59 KB
/
pingroll.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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
FORMAT: 1A
# Pingroll
Pingroll is an API that allows to register users, and webhook templates that can be triggered through the webhook handler.
# Authentication [/api/*]
This API uses Basic auth to protect resources. The `username` is the API key. No password needed.
## Request [GET]
+ Response 401
+ Headers
Www-Authenticate: Basic realm=Restricted
+ Request
+ Headers
Authorization: Basic ZWZiOTQzODZiODRjYzU2YzUwNGY0ZTkzNWQ1MDRlN2QwNmQ0YjMyMDo=
+ Response 200
# Group Users
## User Collection [/api/users]
### List All Users [GET]
+ Response 200 (application/json)
{
"data": [
{
"ID": "d40ef03b-cf65-4f5b-b054-3669359abbc9",
"Name": "foo",
"Number": "+33612345789",
"Always": true
}
]
}
### Create a New User [PUT]
You can register your own user using this action. It takes a JSON object containing a name and a phone number. You may also add an "always" attribute to specify if the user should always receive notification, even if he's not on duty.
+ Attributes (User)
+ Request (application/json)
{
"Name": "bar",
"Number": "+33712345689",
"Always": false
}
+ Response 201 (application/json)
+ Body
{
"ID": "78a53aa2-f214-4c6a-9478-bfa8501de691",
"Name": "bar",
"Number": "+33712345689",
"Always": false
}
## User [/api/users/{user_id}]
A User object has the following attributes.
- ID
- Name
- Number
- Always
+ Parameters
+ user_id: "78a53aa2-f214-4c6a-9478-bfa8501de691" (required, string) - ID of the User
### View a User detail [GET]
+ Response 200 (application/json)
{
"ID": "d40ef03b-cf65-4f5b-b054-3669359abbc9",
"Name": "foo",
"Number": "+33612345789",
"Always": true
}
### Delete [DELETE]
+ Response 204
# Group Webhooks
## Webhook Collection [/api/webhooks]
### List All Webhooks [GET]
+ Response 200 (application/json)
{
"data": [
{
"ID": "d40ef03b-cf65-4f5b-b054-3669359abbc9",
"Name": "foo",
"Template": "{{.foo}}"
}
]
}
### Create a New Webhook [PUT]
You can register your own webhook using this action. It takes a JSON object containing a name and a template.
+ Attributes (Webhook)
+ Request (application/json)
{
"Name": "bar",
"Template": "{{.bar}}"
}
+ Response 201 (application/json)
+ Body
{
"ID": "78a53aa2-f214-4c6a-9478-bfa8501de691",
"Name": "bar",
"Template": "{{.bar}}"
}
## Webhook [/api/webhooks/{webhook_id}]
A User object has the following attributes.
- ID
- Name
- Template
+ Parameters
+ webhook_id: "78a53aa2-f214-4c6a-9478-bfa8501de691" (required, string) - ID of the Webhook
### View a Webhook detail [GET]
+ Response 200 (application/json)
{
"ID": "d40ef03b-cf65-4f5b-b054-3669359abbc9",
"Name": "bar",
"Template": "{{.bar}}",
}
### Delete [DELETE]
+ Response 204
# Data Structures
## User (object)
+ Name (string) - Name of the user
+ Number (string) - Phone number without spaces
+ Always (boolean) - Always receive notification
## Webhook (object)
+ Name (string) - Name of the webhook
+ Template (string) - Golang template template to transform an object into a string