-
Notifications
You must be signed in to change notification settings - Fork 0
/
apiary.apib
118 lines (92 loc) · 3.57 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
109
110
111
112
113
114
115
116
117
118
FORMAT: 1A
HOST: http://datemo.info
# Datemo
Datemo is an API for documents.
## Latest Documents [/latest{?page,type,perpage}]
### View the most recent documents added to the server [GET]
- Parameters
- page - The page of results to request.
- type - The type of document to fetch (note, essay, all) (optional).
- perpage - Number of results per page, defaults to 20 (optional).
+ Response 200 (application/hal+json)
{
"_links": {
"self": { href: "/latest?" },
"next": { href: "/latest?page=2" }
},
"_embedded": {
"documents": [
{
"id": "5902e5c7-23b6-4664-bba6-f5dffd689eee",
"_links": {
"self": { href: "/documents/5902e5c7-23b6-4664-bba6-f5dffd689eee" }
},
"html": "<div><h2>Test</h2><p>This is also a test document.</p></div>"
},
{
"id": "5902e504-6bf6-47be-b1a9-f3e8e0bf4616",
"_links": {
"self": { href: "/documents/5902e504-6bf6-47be-b1a9-f3e8e0bf4616" }
},
"html": "<div><h2>Test</h2><p>This is a test document.</p></div>"
},
{
"id": "5902e58a-4948-4df4-a79f-6627576b506d",
"_links": {
"self": { href: "/documents/5902e58a-4948-4df4-a79f-6627576b506d" }
},
"html": "<div><h2>Test</h2><p>This is a test document.</p></div>"
}
]ct
}
}
## Documents Collection [/documents]
### Create a New Document [POST]
You may create your own document using this action.
- doc-string (string) - The document as an html string.
- type (string) - The type of document (note, or document).
+ Request (application/json)
{
"doc-string": "<p>This is a paragraph.</p>",
}
+ Response 201 (application/hal+json)
{
"_links": {
"self": { "href": "/document/58ca459f-a49f-46da-8bef-4b6cc2006696" }
}
"_embedded": {
"id": "58ca459f-a49f-46da-8bef-4b6cc2006696",
"doc-string": "<h1>Title</h1><p>This is a paragraph.</p>",
"publishedAt": "2014-11-11T08:40:51.620Z",
}
}
## Document Resources [/documents/:id]
### View an Existing Document [GET]
+ Response 200 (application/hal+json)
{
"_links": {
"self": { "href": "/documents/58ca459f-a49f-46da-8bef-4b6cc2006696" }
}
"_embedded": {
"id": "58ca459f-a49f-46da-8bef-4b6cc2006696",
"doc-string": "<h1>Title</h1><p>This is a paragraph.</p>",
"publishedAt": "2014-11-11T08:40:51.620Z",
}
}
### Update an Existing Document [PUT]
+ Request (application/json)
{
"id": "58ca459f-a49f-46da-8bef-4b6cc2006696",
"doc-string": "<p>Update for the document</p>"
}
+ Response 200 (application/hal+json)
{
"_links": {
"self": { "href": "/documents/58ca459f-a49f-46da-8bef-4b6cc2006696" }
}
"_embedded": {
"doc-string": "<p>Updated for the document</p>",
"lastUpdatedAt": "2014-12-30T09:00:23.340Z",
"publishedAt": "2014-11-11T08:40:51.620Z",
}
}