-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathAPI
More file actions
324 lines (314 loc) · 11.8 KB
/
API
File metadata and controls
324 lines (314 loc) · 11.8 KB
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
321
322
323
API reference.
Notes:
Ajax requests must be POST, sent to /ajax/$target.
Response is a json structure with 3 mandatory fields:
response - string, type of response,
status - bool, result of request process,
text - different, body of response.
Search:
Search in database.
Optional `fields` argument can be passed to retrive only certain fields in response.
Request target: /ajax/search/
Request params:
text:
fields: list or nothing. Default: ['air', 'id', 'title', 'episodes', 'release', 'type'],
page: int or nothing. Default: 1,
limit: int or nothing. Default: 20,
string: str,
order: str or nothing. Default: title
Response object:
status: True,
text:
head: [
This list may have variable items count. All items have the same structure
"air"
"id"
"title"
"episodes"
"release"
"type"
],
list: list,
pages:
current: int,
start: int,
count: int,
items: list,
response: "search"
Error object:
status: False,
text: list,
response: "search"
List:
Get main list as JSON-object.
Request target: /ajax/list/
Request params:
text:
status: int or nothing. Default: All statuses,
page: int or nothing. Default: 1,
user: int or nothing. Default: Current user,
order: str or nothing. Default: title
Response object:
status: True,
text:
head: [
This list may have variable items count. All items have the same structure
"air"
"id"
"title"
"episodes"
"release"
"type"
],
list: list,
pages:
current: int,
start: int,
count: int,
items: list,
response: "search"
Error object:
status: False,
text: list,
response: "list"
Get:
Get certain field for record.
Request target: /ajax/get/
Request params:
field: tuple,
id: int
Response object:
status: True,
text:
This dictionary may have one or many keys/values from bellow. Order of fields in "order" named list:
episodesCount: int,
name: [
This list may have variable items count. All items have the same structure
unicode
],
links:
ANN: [
This list may have variable items count. All items have the same structure
unicode
],
Wikipedia: [
This list may have variable items count. All items have the same structure
unicode
],
AniDB: [
This list may have variable items count. All items have the same structure
unicode
],
MAL: [
This list may have variable items count. All items have the same structure
unicode
],
Other: [
This list may have variable items count. All items have the same structure
unicode
],
Official page: [
This list may have variable items count. All items have the same structure
unicode
],
title: unicode,
duration: int,
bundle:
bundles: [
This list may have variable items count. All items have the same structure
id: int,
title: unicode
],
id: int,
air: bool,
genre: unicode,
state:
state: int,
select:
1: "Want",
0: "None",
3: "Done",
2: "Now",
5: "Partially watched",
4: "Dropped",
release: unicode,
order: tuple,
type: unicode,
id: int,
id: int,
response: "get"
Error object:
No global errors for the get rerquest.
All fields errors in response `text` parameter.
Statistics:
User statisics.
Returns statistics for curren user if `user_id` is not set.
Request target: /ajax/stat/
Request params:
user_id: int or nothing
Response object:
status: True,
text:
stat: [
count: int,
anime__duration: int or nothing,
full: int or nothing,
name: unicode,
anime__episodesCount: int or nothing,
custom: int or nothing
],
userid: int,
response: "stat"
Error object:
status: False,
text: list,
response: "stat"
Filter:
Apply filter to site output.
Request target: /ajax/filter/
Request params:
releasedAt: datetime or unicode,
endedAt: datetime or unicode,
episodesCount_1: int or nothing,
episodesCount_0: int,
episodesCount_2: bool or nothing,
releaseType: list,
state: list,
duration_2: bool or nothing,
duration_1: int or nothing,
duration_0: int,
genre: list
Response object:
status: True,
text:
head: [
This list may have variable items count. All items have the same structure
"air"
"id"
"title"
"episodes"
"release"
"type"
],
list: list,
pages:
current: int,
start: int,
count: int,
items: list,
response: "search"
Error object:
status: False,
text: dict,
response: "filter"
Login:
Login to site.
Request target: /ajax/login/
Request params:
username: unicode,
password: unicode
Response object:
status: True,
text:
name: unicode,
response: "login"
Error object:
status: False,
text: dict,
response: "login"
Forms:
This API call returns JSON-serialized form for field.
Request target: /ajax/form/
Request params:
field: unicode or nothing,
model: unicode,
id: int
Response object:
status: True,
field: unicode or nothing,
model: unicode,
id: int,
form: [
This data is serialised form fields list. Field types:
bundle: [
{'input': {'id': 'id_Bundle 0', 'name': 'Bundle 0', 'value': unicode or nothing, 'label': Bundle 0}}
{'input': {'id': 'id_Bundle 1', 'name': 'Bundle 1', 'value': unicode or nothing, 'label': Bundle 1}}
],
state: {'select': {'name': 'state', 'choices': [(0, u'None'), (1, u'Want'), (2, u'Now'), (3, u'Done'), (4, u'Dropped'), (5, u'Partially watched')], 'id': 'id_state', 'value': int or nothing, 'label': State}},
anime:
releasedAt: {'input': {'id': 'id_releasedAt', 'name': 'releasedAt', 'value': date or nothing, 'label': Released}},
episodesCount: {'input': {'id': 'id_episodesCount', 'name': 'episodesCount', 'value': int or nothing, 'label': EpisodesCount}},
endedAt: {'input': {'id': 'id_endedAt', 'name': 'endedAt', 'value': date or nothing, 'label': Ended}},
title: {'input': {'id': 'id_title', 'name': 'title', 'value': unicode or nothing, 'label': Title}},
releaseType: {'select': {'name': 'releaseType', 'choices': [(0, u'TV'), (1, u'Movie'), (2, u'OAV'), (3, u'TV-Sp'), (4, u'SMovie'), (5, u'ONA'), (6, u'AMV'), (7, u'Other')], 'id': 'id_releaseType', 'value': int or nothing, 'label': ReleaseType}},
air: {'input': {'id': 'id_air', 'name': 'air', 'value': unicode or nothing, 'label': Air}},
duration: {'input': {'id': 'id_duration', 'name': 'duration', 'value': int or nothing, 'label': Duration}},
links: [
{'input': {'id': 'id_Link 0', 'name': 'Link 0', 'value': unicode or nothing, 'label': Link 0}}
{'select': {'name': 'Link type 0', 'choices': [(0, u'Auto'), (1, u'AniDB'), (2, u'ANN'), (3, u'MAL'), (4, u'Wikipedia'), (6, u'Official page'), (15, u'Other')], 'id': 'id_Link type 0', 'value': int or nothing, 'label': Link type 0}}
],
name: [
{'input': {'id': 'id_Name 0', 'name': 'Name 0', 'value': unicode or nothing, 'label': Name 0}}
{'input': {'id': 'id_Name 1', 'name': 'Name 1', 'value': unicode or nothing, 'label': Name 1}}
]
]
Error object:
status: False,
text: unicode,
id: unicode,
field: unicode or nothing,
model: unicode,
response: "form"
Add:
Add new record.
This is a `form` field. It returns form if requested without parameters.
Request target: /ajax/add/
Request params:
releasedAt: datetime or unicode,
genre: list,
episodesCount: int,
endedAt: datetime or unicode,
title: unicode,
duration: int,
releaseType: int
Response without arguments:
releasedAt: {'input': {'id': 'id_releasedAt', 'name': 'releasedAt', 'value': date or nothing, 'label': ReleasedAt}},
genre: [
{'input': {'id': 'id_genre', 'name': 'genre', 'value': int or nothing, 'label': Genre}}
{'input': {'id': 'id_genre', 'name': 'genre', 'value': int or nothing, 'label': Genre}}
],
episodesCount: {'input': {'id': 'id_episodesCount', 'name': 'episodesCount', 'value': int or nothing, 'label': EpisodesCount}},
endedAt: {'input': {'id': 'id_endedAt', 'name': 'endedAt', 'value': date or nothing, 'label': EndedAt}},
title: {'input': {'id': 'id_title', 'name': 'title', 'value': unicode or nothing, 'label': Title}},
duration: {'input': {'id': 'id_duration', 'name': 'duration', 'value': int or nothing, 'label': Duration}},
releaseType: {'select': {'name': 'releaseType', 'choices': [(0, u'TV'), (1, u'Movie'), (2, u'OAV'), (3, u'TV-Sp'), (4, u'SMovie'), (5, u'ONA'), (6, u'AMV'), (7, u'Other')], 'id': 'id_releaseType', 'value': int or nothing, 'label': ReleaseType}},
air: {'input': {'id': 'id_air', 'name': 'air', 'value': bool or nothing, 'label': Air}}
Response object:
status: True,
id: int,
response: "add"
Error object:
status: False,
text: dict,
response: "add"
Set:
Change field.
Request target: /ajax/set/
Request params:
field: unicode or nothing,
model: unicode,
id: int
Response object:
status: True,
field: unicode or nothing,
text: dict,
model: unicode,
id: int,
response: "edit"
Error object:
status: False,
text: dict,
id: int,
field: unicode or nothing,
model: unicode,
response: "form"