You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Without authentication, this endpoint retrieves all top-level public albums. When authenticated, unlisted albums are also returned. Unless the `flat` parameter is used, only the first level albums will be returned. To get a set's albums, see "Get album contents".
11
+
12
+
### Endpoint
13
+
14
+
`GET /albums`
15
+
16
+
### Query Parameters
17
+
18
+
Parameter | Default | Description | Valid values
19
+
--------- | ------- | ----------- | ------------
20
+
day | false | Return albums from a particular day. Requires a valid year and month parameter. | Any valid day. ex: 1
21
+
day_not | false | Return albums from all buy one particular day. Requires a valid year and month parameter. | Any valid day. ex: 1
22
+
flat | false | Return all albums in the list, regardless of their hierachacal level. | true or false
23
+
id_not | false | Exclude albums from the list by id. | Any album ID. Exclude multiple IDs using a comma. Ex: 1,2
24
+
include_empty | true | If false, albums containing no content are omitted from the results. | true or false
25
+
limit | false | Limit the number of albums to return per page of results. | Any number greater than zero.
26
+
listed | true | If false, unlisted albums are retured as well. Requires authorization. | true or false
27
+
match_all_tags | false | When using tags or tags_not, whether to look for all of the supplied tags. | true or false
28
+
month | false | Return albums from a particular month. Requires a valid year parameter. | Any valid month. ex: 1
29
+
month_not | false | Return albums from all buy one particular month. Requires a valid year parameter. | Any valid month. ex: 1
30
+
order_by | title | What data is used to sort the returned list. | title, published_on, modified_on, created_on
31
+
order_direction | ASC | Whether to sort in ASC or DESC order. | ASC or DESC
32
+
page | 1 | See pagination. | Any number from 1 to total_pages.
33
+
search | false | String to search by. Search is performed on the album's title, description and tag fields unless search_filter is defined. | Any string
34
+
search_filter | false | Limit the fields used in the search. | title, description or tags
35
+
tags | false | Search for albums with specific tags. | Any string. Separate multiple tags with a comma.
36
+
tags_not | false | Search for albums without specific tags. | Any string. Separate multiple tags with a comma.
37
+
types | all | Return only sets or standard albums. | all, set or standard
38
+
with_covers | true | Whether or not to return cover data with each album | true or false
39
+
year | false | Return albums from a particular year. | Any valid year. ex: 2014
40
+
year_not | false | Return albums from all buy one particular year. | Any valid year. ex: 2014
41
+
42
+
## Get albums tree
43
+
44
+
```shell
45
+
curl -H "Accepts: application/json" \
46
+
http://mysite.com/api.php?/albums/tree
47
+
```
48
+
49
+
> Get unlisted tree:
50
+
51
+
```shell
52
+
curl -H "Accepts: application/json" \
53
+
-H "X-Koken-Token: your-token-here" \
54
+
http://mysite.com/api.php?/albums/tree/listed:0
55
+
```
56
+
57
+
Get hierarchical view of the album tree.
58
+
59
+
### Endpoint
60
+
61
+
`GET /albums/tree`
62
+
63
+
Parameter | Default | Description | Valid values
64
+
--------- | ------- | ----------- | ------------
65
+
listed | true | Whether to return listed or unlisted album tree (unlisted requires authentication). | true or false
66
+
include_empty | true | Whether to return empty albums in the result. | true or false
67
+
68
+
## Get a specific album
69
+
70
+
```shell
71
+
curl -H "Accepts: application/json" \
72
+
http://mysite.com/api.php?/albums/1
73
+
```
74
+
75
+
Get any album by numeric ID or slug.
76
+
77
+
<asideclass="notice">If you attempt to retrive an unlisted album without authentication, this endpoint will return a 403 Forbidden error.</aside>
78
+
79
+
### Endpoint
80
+
81
+
`GET /albums/1` or `GET /albums/slug:my-album`
82
+
83
+
### Query Parameters
84
+
85
+
Parameter | Default | Description | Valid values
86
+
--------- | ------- | ----------- | ------------
87
+
neighbors | 2 | How many neigboring albums to load. | Any even number.
88
+
include_empty_neighbors | false | Whether to load empty albums when looking for neighboring albums. | true or false
89
+
90
+
## Get album content
91
+
92
+
```shell
93
+
curl -H "Accepts: application/json" \
94
+
http://mysite.com/api.php?/albums/1/content
95
+
```
96
+
97
+
Get any album and its member content (images for a standard album, albums for a set).
98
+
99
+
<asideclass="notice">If you attempt to retrive an unlisted album without authentication, this endpoint will return a 403 Forbidden error.</aside>
100
+
101
+
### Endpoint
102
+
103
+
`GET /albums/1/content` or `GET /albums/slug:my-album/content`
104
+
105
+
### Query Parameters
106
+
107
+
TODO (only list params that differ from album or content listing)
Every installation of Koken exposes an API that can be used to read and write data from that install.
16
16
17
-
To make a request to the API, you will need the install's API path, which is the domain and path to the Koken installation. For the rest of this document, we'll assume that the API path is:
17
+
To make a request to the API, you will need the install's API path, which is the domain and path to the Koken installation. The user of the install will need to supply your application with the appropriate token by logging in to their Koken install and visiting Settings > Applications.
18
18
19
-
`http://myphotosite.com/koken`
19
+
For the rest of this document, we'll assume that the API path is:
To make a request, you will need to form the URL to the endpoint using the supplied API path and the endpoint you are wishing to access. To determine the URL to call, think of this psuedo code:
@@ -30,27 +32,26 @@ To make a request, you will need to form the URL to the endpoint using the suppl
30
32
31
33
For example, to call the `/content` endpoint, the full URL would be:
Currently, all Koken API responses return data as JSON. For future proofing, we recommend explicitly passing the `Accept` header.
44
+
Currently, all Koken API responses return data as JSON. In the future, Koken may provide other response formats, so we recommend explicitly passing the `Accept` HTTP header.
@@ -63,12 +64,12 @@ When the Koken API encounters an error, it returns an appropriate HTTP error cod
63
64
64
65
# Authentication
65
66
66
-
> To authorize, send the token in a custom HTTP header:
67
+
> To authorize, send the token in the X-Koken-Token custom HTTP header:
67
68
68
69
```shell
69
70
curl -H "Accepts: application/json" \
70
71
-H "X-Koken-Token: your-token-here" \
71
-
http://myphotosite.com/koken/api.php?/content
72
+
http://mysite.com/api.php?/content
72
73
```
73
74
74
75
To read public data from a Koken install, authorization is not required. To read unlisted or private information, or to make modifications to content via the API, authorization is required via *tokens*. There are two levels of token permissions:
@@ -98,7 +99,7 @@ The user of the install will need to generate and supply your application with t
Because Koken's entire endpoint is contained in the query string, parameters are passed as key/value pairs in the URL itself. All parameters should be placed at the end of the API URL.
@@ -116,115 +117,5 @@ Because Koken's entire endpoint is contained in the query string, parameters are
> The above command returns JSON structured like this:
132
-
133
-
```json
134
-
[
135
-
{
136
-
"id": 1,
137
-
"name": "Fluffums",
138
-
"breed": "calico",
139
-
"fluffiness": 6,
140
-
"cuteness": 7
141
-
},
142
-
{
143
-
"id": 2,
144
-
"name": "Isis",
145
-
"breed": "unknown",
146
-
"fluffiness": 5,
147
-
"cuteness": 10
148
-
}
149
-
]
150
-
```
151
-
152
-
Without authentication, this endpoint retrieves all public albums. When authenticated, unlisted albums are also returned.
153
-
154
-
### Endpoint
155
-
156
-
`GET /albums`
157
-
158
-
### Query Parameters
159
-
160
-
Parameter | Default | Description | Valid values
161
-
--------- | ------- | ----------- | ------------
162
-
day | false | Return albums from a particular day. Requires a valid year and month parameter. | Any valid day. ex: 1
163
-
day_not | false | Return albums from all buy one particular day. Requires a valid year and month parameter. | Any valid day. ex: 1
164
-
flat | false | Return all albums in the list, regardless of their hierachacal level. | true or false
165
-
id_not | false | Exclude albums from the list by id. | Any album ID. Exclude multiple IDs using a comma. Ex: 1,2
166
-
include_empty | true | If false, albums containing no content are omitted from the results. | true or false
167
-
limit | false | Limit the number of albums to return per page of results. | Any number greater than zero.
168
-
listed | true | If false, unlisted albums are retured as well. Requires authorization. | true or false
169
-
match_all_tags | false | When using tags or tags_not, whether to look for all of the supplied tags. | true or false
170
-
month | false | Return albums from a particular month. Requires a valid year parameter. | Any valid month. ex: 1
171
-
month_not | false | Return albums from all buy one particular month. Requires a valid year parameter. | Any valid month. ex: 1
172
-
order_by | title | What data is used to sort the returned list. | title, published_on, modified_on, created_on
173
-
order_direction | ASC | Whether to sort in ASC or DESC order. | ASC or DESC
174
-
page | 1 | See pagination. | Any number from 1 to total_pages.
175
-
search | false | String to search by. Search is performed on the album's title, description and tag fields unless search_filter is defined. | Any string
176
-
search_filter | false | Limit the fields used in the search. | title, description or tags
177
-
tags | false | Search for albums with specific tags. | Any string. Separate multiple tags with a comma.
178
-
tags_not | false | Search for albums without specific tags. | Any string. Separate multiple tags with a comma.
179
-
types | all | Return only sets or standard albums. | all, set or standard
180
-
with_covers | true | Whether or not to return cover data with each album | true or false
181
-
year | false | Return albums from a particular year. | Any valid year. ex: 2014
182
-
year_not | false | Return albums from all buy one particular year. | Any valid year. ex: 2014
183
-
184
-
## Get a specific album
185
-
186
-
```ruby
187
-
require'kittn'
188
-
189
-
api =Kittn::APIClient.authorize!('meowmeowmeow')
190
-
api.kittens.get(2)
191
-
```
192
-
193
-
```python
194
-
import'kittn'
195
-
196
-
api = Kittn.authorize('meowmeowmeow')
197
-
api.kittens.get(2)
198
-
```
199
-
200
-
```shell
201
-
curl "http://example.com/api/kittens/3"
202
-
-H "Authorization: meowmeowmeow"
203
-
```
204
-
205
-
> The above command returns JSON structured like this:
206
-
207
-
```json
208
-
{
209
-
"id": 2,
210
-
"name": "Isis",
211
-
"breed": "unknown",
212
-
"fluffiness": 5,
213
-
"cuteness": 10
214
-
}
215
-
```
216
-
217
-
This endpoint retrieves a specific kitten.
218
-
219
-
<asideclass="warning">If you're not using an administrator API key, note that some kittens will return 403 Forbidden if they are hidden for admins only.</aside>
0 commit comments