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
- <a href='http://github.com/tripit/slate'>Documentation Powered by Slate</a>
12
6
13
7
includes:
14
8
- errors
@@ -18,67 +12,120 @@ search: true
18
12
19
13
# Introduction
20
14
21
-
Welcome to the Kittn API! You can use our API to access Kittn API endpoints, which can get information on various cats, kittens, and breeds in our database.
15
+
Every installation of Koken exposes an API that can be used to read and write data from that install.
22
16
23
-
We have language bindings in Shell, Ruby, and Python! You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.
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:
24
18
25
-
This example API documentation page was created with [Slate](http://github.com/tripit/slate). Feel free to edit it and use it as a base for your own API's documentation.
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:
33
28
34
-
api =Kittn::APIClient.authorize!('meowmeowmeow')
29
+
`API Path + 'api.php?' + endpoint`
30
+
31
+
For example, to call the `/content` endpoint, the full URL would be:
When the Koken API encounters an error, it returns an appropriate HTTP error code as well as a JSON payload with more information about the error.
63
+
64
+
# Authentication
65
+
66
+
> To authorize, send the token in a custom HTTP header:
67
+
43
68
```shell
44
-
# With shell, you can just pass the correct header with each request
45
-
curl "api_endpoint_here"
46
-
-H "Authorization: meowmeowmeow"
69
+
curl -H "Accepts: application/json" \
70
+
-H "X-Koken-Token: your-token-here" \
71
+
http://myphotosite.com/koken/api.php?/content
47
72
```
48
73
49
-
> Make sure to replace `meowmeowmeow` with your API key.
74
+
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:
50
75
51
-
Kittn uses API keys to allow access to the API. You can register a new Kittn API key at our [developer portal](http://example.com/developers).
76
+
Permissions | Description
77
+
--------- | -----------
78
+
read | Access to all public, unlisted and private content, albums and essays.
79
+
read-write | Same permissions as read but also with permission to create and delete.
52
80
53
-
Kittn expects for the API key to be included in all API requests to the server in a header that looks like the following:
81
+
The user of the install will need to generate and supply your application with the appropriate token by logging in to their Koken install and visiting `Settings > Applications`.
54
82
55
-
`Authorization: meowmeowmeow`
83
+
# Pagination
56
84
57
-
<asideclass="notice">
58
-
You must replace `meowmeowmeow` with your personal API key.
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.
74
114
75
-
api = Kittn.authorize('meowmeowmeow')
76
-
api.kittens.get()
115
+
> Boolean parameters should be passed as a 0 (for false) or 1 (for true);
Without authentication, this endpoint retrieves all public albums. When authenticated, unlisted albums are also returned.
106
153
107
-
### HTTP Request
154
+
### Endpoint
108
155
109
-
`GET http://example.com/kittens`
156
+
`GET /albums`
110
157
111
158
### Query Parameters
112
159
113
-
Parameter | Default | Description
114
-
--------- | ------- | -----------
115
-
include_cats | false | If set to true, the result will also include cats.
116
-
available | true | If set to false, the result will include kittens that have already been adopted.
117
-
118
-
<asideclass="success">
119
-
Remember — a happy kitten is an authenticated kitten!
120
-
</aside>
121
-
122
-
## Get a Specific Kitten
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
0 commit comments