-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsadasdasdas-apiary.apib
201 lines (133 loc) · 5.27 KB
/
sadasdasdas-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
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
FORMAT: 1A
HOST: http://api.gistfox.com
# sadasdasdas
Gist Fox API is a **pastes service** similar to [GitHub's Gist](http://gist.github.com).
## Authentication
Currently the Gist Fox API does not provide authenticated access.
## Media Types
Where applicable this API uses the [HAL+JSON](https://github.com/mikekelly/hal_specification/blob/master/hal_specification.md) media-type to represent resources states and affordances.
Requests with a message-body are using plain JSON to set or update resource states.
## Error States
The common [HTTP Response Status Codes](https://github.com/for-GET/know-your-http-well/blob/master/status-codes.md) are used.
# Group Entry Point
# Gist Fox API Root [/]
Gist Fox API entry point.
This resource does not have any attributes. Instead it offers the initial API affordances in the form of the HTTP Link header and
HAL links.
## Retrieve the Entry Point [GET]
+ Response 200 (application/hal+json)
+ Headers
Link: <http:/api.gistfox.com/>;rel="self",<http:/api.gistfox.com/gists>;rel="gists"
+ Body
{
"_links": {
"self": { "href": "/" },
"gists": { "href": "/gists?{since}", "templated": true }
}
}
# Group Gist
Gist-related resources of *Gist Fox API*.
## Gist [/gists/{id}]
A single Gist object. The Gist resource is the central resource in the Gist Fox API. It represents one paste - a single text note.
The Gist resource has the following attributes:
- id
- created_at
- description
- content
The states *id* and *created_at* are assigned by the Gist Fox API at the moment of creation.
+ Parameters
+ id (string) ... ID of the Gist in the form of a hash.
+ Model (application/hal+json)
HAL+JSON representation of Gist Resource. In addition to representing its state in the JSON form it offers affordances in the form of the HTTP Link header and HAL links.
+ Headers
Link: <http:/api.gistfox.com/gists/42>;rel="self", <http:/api.gistfox.com/gists/42/star>;rel="star"
+ Body
{
"_links": {
"self": { "href": "/gists/42" },
"star": { "href": "/gists/42/star" },
},
"id": "42",
"created_at": "2014-04-14T02:15:15Z",
"description": "Description of Gist",
"content": "String contents"
}
### Retrieve a Single Gist [GET]
+ Response 200
[Gist][]
### Edit a Gist [PATCH]
To update a Gist send a JSON with updated value for one or more of the Gist resource attributes. All attributes values (states) from the previous version of this Gist are carried over by default if not included in the hash.
+ Request (application/json)
{
"content": "Updated file contents"
}
+ Response 200
[Gist][]
### Delete a Gist [DELETE]
+ Response 204
## Gists Collection [/gists{?since}]
Collection of all Gists.
The Gist Collection resource has the following attribute:
- total
In addition it **embeds** *Gist Resources* in the Gist Fox API.
+ Model (application/hal+json)
HAL+JSON representation of Gist Collection Resource. The Gist resources in collections are embedded. Note the embedded Gists resource are incomplete representations of the Gist in question. Use the respective Gist link to retrieve its full representation.
+ Headers
Link: <http:/api.gistfox.com/gists>;rel="self"
+ Body
{
"_links": {
"self": { "href": "/gists" }
},
"_embedded": {
"gists": [
{
"_links" : {
"self": { "href": "/gists/42" }
},
"id": "42",
"created_at": "2014-04-14T02:15:15Z",
"description": "Description of Gist"
}
]
},
"total": 1
}
### List All Gists [GET]
+ Parameters
+ since (optional, string) ... Timestamp in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ` Only gists updated at or after this time are returned.
+ Response 200
[Gists Collection][]
### Create a Gist [POST]
To create a new Gist simply provide a JSON hash of the *description* and *content* attributes for the new Gist.
+ Request (application/json)
{
"description": "Description of Gist",
"content": "String content"
}
+ Response 201 (application/hal+json)
[Gist][]
## Star [/gists/{id}/star]
Star resource represents a Gist starred status.
The Star resource has the following attribute:
- starred
+ Parameters
+ id (string) ... ID of the gist in the form of a hash
+ Model (application/hal+json)
HAL+JSON representation of Star Resource.
+ Headers
Link: <http:/api.gistfox.com/gists/42/star>;rel="self"
+ Body
{
"_links": {
"self": { "href": "/gists/42/star" },
},
"starred": true
}
### Star a Gist [PUT]
+ Response 204
### Unstar a Gist [DELETE]
+ Response 204
### Check if a Gist is Starred [GET]
+ Response 200
[Star][]