-
Notifications
You must be signed in to change notification settings - Fork 481
/
example.apib
320 lines (212 loc) · 6.3 KB
/
example.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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
FORMAT: 1A
HOST: https://api.example.com
# API Title
[Markdown](http://daringfireball.net/projects/markdown/syntax) **formatted** description.
## Subtitle
Also Markdown *formatted*. This also includes automatic "smartypants" formatting -- hooray!
> "A quote from another time and place"
Another paragraph. Code sample:
```http
Authorization: bearer 5262d64b892e8d4341000001
```
And some code with no highlighting:
```no-highlight
Foo bar baz
```
1. A list
2. Of items
3. Can be
4. Very useful
Here is a table:
ID | Name | Description
--:| ---- | -----------
1 | Foo | I am a foo.
8 | Bar | I am a bar.
15 | Baz | I am a baz.
::: note
## Extensions
Some non-standard Markdown extensions are also supported, such as this informational container, which can also contain **formatting**. Features include:
* Informational block fenced with `::: note` and `:::`
* Warning block fenced with `::: warning` and `:::`
* [x] GitHub-style checkboxes using `[x]` and `[ ]`
* Emoji support :smile: :ship: :cake: using `:smile:` ([cheat sheet](http://www.emoji-cheat-sheet.com/))
These extensions may change in the future as the [CommonMark specification](http://spec.commonmark.org/) defines a [standard extension syntax](https://github.com/jgm/CommonMark/wiki/Proposed-Extensions).
:::
<!-- include(example-include.md) -->
# Data Structures
## NoteData
+ id: 1 (required, number) - Unique identifier
+ title: Grocery list (required) - Single line description
+ body: Buy milk - Full description of the note which supports Markdown.
## NoteList (array)
+ (NoteData)
# Group Notes
Group description (also with *Markdown*)
## Important Info
Descriptions may also contain sub-headings and **more Markdown**.
## Note List [/notes]
Note list description
+ Even
+ More
+ Markdown
### Get Notes [GET]
Get a list of notes.
+ Response 200 (application/json)
+ Headers
X-Request-ID: f72fc914
X-Response-Time: 4ms
+ Attributes (NoteList)
### Create New Note [POST]
Create a new note using a title and an optional content body.
+ Request with body (application/json)
+ Body
{
"title": "My new note",
"body": "This is the body"
}
+ Response 201
+ Response 400 (application/json)
+ Body
{
"error": "Invalid title"
}
+ Request without body (application/json)
+ Body
{
"title": "My new note"
}
+ Response 201
+ Response 400 (application/json)
+ Body
{
"error": "Invalid title"
}
## Note [/notes/{id}{?body}]
Note description
+ Parameters
+ id: `68a5sdf67` (required, string) - The note ID
### Get Note [GET]
Get a single note.
+ Parameters
+ body: `false` (boolean) - Set to `false` to exclude note body content.
+ Response 200 (application/json)
+ Headers
X-Request-ID: f72fc914
X-Response-Time: 4ms
+ Attributes (NoteData)
+ Response 404 (application/json)
+ Headers
X-Request-ID: f72fc914
X-Response-Time: 4ms
+ Body
{
"error": "Note not found"
}
### Update a Note [PUT]
Update a single note by setting the title and/or body.
::: warning
#### <i class="fa fa-warning"></i> Caution
If the value for `title` or `body` is `null` or `undefined`, then the corresponding value is not modified on the server. However, if you send an empty string instead then it will **permanently overwrite** the original value.
:::
+ Request (application/json)
+ Body
{
"title": "Grocery List (Safeway)"
}
+ Response 200 (application/json)
+ Headers
X-Request-ID: f72fc914
X-Response-Time: 4ms
+ Attributes (NoteData)
+ Response 404 (application/json)
+ Headers
X-Request-ID: f72fc914
X-Response-Time: 4ms
+ Body
{
"error": "Note not found"
}
+ Request delete body (application/json)
+ Body
{
"body": ""
}
+ Response 200 (application/json)
+ Headers
X-Request-ID: f72fc914
X-Response-Time: 4ms
+ Attributes (NoteData)
+ Response 404 (application/json)
+ Headers
X-Request-ID: f72fc914
X-Response-Time: 4ms
+ Body
{
"error": "Note not found"
}
### Delete a Note [DELETE]
Delete a single note
+ Response 204
+ Response 404 (application/json)
+ Headers
X-Request-ID: f72fc914
X-Response-Time: 4ms
+ Body
{
"error": "Note not found"
}
# Group Users
Group description
## User List [/users{?name,joinedBefore,joinedAfter,sort,limit}]
A list of users
+ Parameters
+ name: `alice` (string, optional) - Search for a user by name
+ joinedBefore: `2011-01-01` (string, optional) - Search by join date
+ joinedAfter: `2011-01-01` (string, optional, ) - Search by join date
+ sort: `joined` (string, optional) - Which field to sort by
+ Default: `name`
+ Members
+ `name`
+ `joined`
+ `-joined`
+ `age`
+ `-age`
+ `location`
+ `-location`
+ `plan`
+ `-plan`
+ limit: `25` (integer, optional) - The maximum number of users to return, up to `50`
+ Default: `10`
### Get users [GET]
Get a list of users. Example:
```no-highlight
https://api.mywebsite.com/users?sort=joined&limit=5
```
+ Response 200 (application/json)
+ Body
[
{
"name": "alice",
"image": "http://example.com/alice.jpg",
"joined": "2013-11-01"
},
{
"name": "bob",
"image": "http://example.com/bob.jpg",
"joined": "2013-11-02"
}
]
+ Schema
<!-- include(example-schema.json) -->
# Group Tags and Tagging Long Title
Get or set tags on notes
## GET /tags
Get a list of bars
+ Response 200 (application/json)
["tag1", "tag2", "tag3"]
## Get one tag [/tags/{id}]
Get a single tag
+ Parameters
+ id - Unique tag identifier
### GET
+ Response 200