UDP API Definition: Difference between revisions
Jump to navigation
Jump to search
Epoximator (talk | contribs) |
Epoximator (talk | contribs) (reported by darsh) |
||
Line 19: | Line 19: | ||
=== Content Encoding === | === Content Encoding === | ||
:* Current character encoding used by the api: ''' | :* Current character encoding used by the api: '''ascii''' | ||
:* Escape scheme for option values: html form encoding + newline | :* Escape scheme for option values: html form encoding + newline | ||
:: this means you have to encode at least & | :: this means you have to encode at least & in your option values in html form encoding style before sending them to the api server. All other html form encodings are optional. | ||
:* All newlines should be replaced by <br> | :* All newlines should be replaced by <br /> | ||
:: escape scheme for returned data fields: ', | and newline | :: escape scheme for returned data fields: ', | and newline | ||
:: newlines are encoded as <br />, | is not allowed in data fields and ' is encoded as | :: newlines are encoded as <br />, | is not allowed in data fields and ' is encoded as `. | ||
== Basics == | == Basics == | ||
Line 49: | Line 49: | ||
* General return data: | * General return data: | ||
{three digit return code} {str return string}\n | {three digit return code} {str return string}\n | ||
{data field 0}|{data field 1}|...|{data field n} | {data field 0}|{data field 1}|...|{data field n}\n | ||
* Exceptions are 200,201,271,272,504 which returns additional data in the first line. | * Exceptions are 200,201,271,272,504 which returns additional data in the first line. | ||
Line 226: | Line 226: | ||
'''Info:''' | '''Info:''' | ||
* This command only works if you are already logged in. | * This command only works if you are already logged in. | ||
* A logout should ALWAYS be issued if the client is currently logged in and is either exiting or not expecting to send/ | * A logout should ALWAYS be issued if the client is currently logged in and is either exiting or not expecting to send/receive any anidb api packets for the next >= 30 minutes. | ||
== Notify Commands == | == Notify Commands == | ||
Line 238: | Line 238: | ||
* Use NOTIFYGET to receive a notification. | * Use NOTIFYGET to receive a notification. | ||
* Use NOTIFYACK to remove a notification (from NOTIFYLIST). | * Use NOTIFYACK to remove a notification (from NOTIFYLIST). | ||
It is probably a good idea to use tags to separate NOTIFICATIONs from other | It is probably a good idea to use tags to separate NOTIFICATIONs from the other communication. NOTIFICATIONs will '''never''' have tags. | ||
=== PUSH: UDP Notification Registration === | === PUSH: UDP Notification Registration === | ||
Line 247: | Line 247: | ||
* 270 NOTIFICATION ENABLED | * 270 NOTIFICATION ENABLED | ||
OR (if both values are 0) | OR (if both values are 0) | ||
*370 NOTIFICATION DISABLED | * 370 NOTIFICATION DISABLED | ||
'''Note:''' | '''Note:''' | ||
Line 298: | Line 298: | ||
* 290 NOTIFICATION | * 290 NOTIFICATION | ||
: {int4 pending_notifies}|{int4 pending_msgs} | : {int4 pending_notifies}|{int4 pending_msgs} | ||
'''Info:''' | '''Info:''' | ||
Line 320: | Line 319: | ||
: {str type}|{int4 id} | : {str type}|{int4 id} | ||
: ... | : ... | ||
'''Info:''' | '''Info:''' | ||
Line 345: | Line 343: | ||
: {int4 aid}|{int4 type}|{int2 count}|{int4 date}|{str anime_name} | : {int4 aid}|{int4 type}|{int2 count}|{int4 date}|{str anime_name} | ||
* 393 NO SUCH ENTRY | * 393 NO SUCH ENTRY | ||
'''Info:''' | '''Info:''' | ||
Line 370: | Line 365: | ||
* NOTIFYACK type={str type}&id={int4 id} | * NOTIFYACK type={str type}&id={int4 id} | ||
'''Possible Replies:''' | '''Possible Replies:'''<br> | ||
when type = M | |||
* 281 NOTIFYACK SUCCESSFUL | |||
* 381 NO SUCH ENTRY | |||
when type = N | |||
* 282 NOTIFYACK SUCCESSFUL | * 282 NOTIFYACK SUCCESSFUL | ||
* 382 NO SUCH ENTRY | * 382 NO SUCH ENTRY | ||
'''Info:''' | '''Info:''' | ||
Line 384: | Line 381: | ||
== Data Commands == | == Data Commands == | ||
=== ANIME: | === ANIME: Retrieve Anime Data === | ||
'''Command String:'''<br> | '''Command String:'''<br> | ||
by aid | by aid | ||
Line 413: | Line 410: | ||
---- | ---- | ||
=== EPISODE: | === EPISODE: Retrieve Episode Data === | ||
'''Command String:'''<br> | '''Command String:'''<br> | ||
by eid | by eid | ||
Line 428: | Line 425: | ||
'''Info:''' | '''Info:''' | ||
* length is in minutes | * length is in minutes | ||
* epno includes special character (only if special) and padding (only if normal) | * Returned 'epno' includes special character (only if special) and padding (only if normal). Special characters are S(special), C(credits), T(trailer), P(parody), O(other). | ||
'''Examples:''' (html escaped code intended) | '''Examples:''' (html escaped code intended) | ||
Line 440: | Line 437: | ||
---- | ---- | ||
=== GROUP: | === GROUP: Retrieve Group Data === | ||
'''Command String:'''<br> | '''Command String:'''<br> | ||
by gid | by gid | ||
Line 487: | Line 484: | ||
: However this name does not contain all the extra information of the filenames on AniDB and might be composed slightly different. | : However this name does not contain all the extra information of the filenames on AniDB and might be composed slightly different. | ||
* fcode and acode is integers where each bit corresponds to a data field related to the specified file (se below). The data list received is sorted in the same order as the tables (and fcode before acode). {f|a}code=-1 means retrieve all fields. | * fcode and acode is integers where each bit corresponds to a data field related to the specified file (se below). The data list received is sorted in the same order as the tables (and fcode before acode). {f|a}code=-1 means retrieve all fields. | ||
* Only the first matching file is returned when aname, gname and epno is used. | |||
'''State:''' | '''State:''' | ||
Line 798: | Line 796: | ||
'''Possible Replies:''' | '''Possible Replies:''' | ||
* 206 STATS | * 206 STATS | ||
: {int4 animes)|{int4 eps}|{int4 files}|{int4 groups}|{int4 users}|{int4 creqs} | : {int4 animes)|{int4 eps}|{int4 files}|{int4 groups}|{int4 users}|{int8 total file size in bytes}|{int4 open [[creq|creqs]]} | ||
---- | ---- | ||
Line 820: | Line 818: | ||
'''Info:''' | '''Info:''' | ||
* All strings are user names. | |||
* 'Hide myself in IRC stats' applies for this too. | * 'Hide myself in IRC stats' applies for this too. | ||
Line 833: | Line 832: | ||
'''Note:''' | '''Note:''' | ||
* This command allows you to send an AniDB message. | * This command allows you to send an AniDB message. | ||
{{eyecatch|IMPORTANT:| | {{eyecatch|IMPORTANT:| | ||
title must not be longer than | title must not be longer than 50 chars. | ||
body must not be longer than | body must not be longer than 900 chars. | ||
}} | }} | ||
Line 853: | Line 851: | ||
* 598 UNKNOWN COMMAND | * 598 UNKNOWN COMMAND | ||
== | == Return Codes == | ||
Note: The names below do _not_ necessarily reflect the actual code strings returned by the server. | |||
<pre> | <pre> | ||
/* | /* | ||
* POSITVE 2XX | * POSITVE 2XX | ||
*/ | */ | ||
LOGIN_ACCEPTED =200, | LOGIN_ACCEPTED =200, | ||
LOGIN_ACCEPTED_NEW_VER =201, | LOGIN_ACCEPTED_NEW_VER =201, | ||
LOGGED_OUT =203, | LOGGED_OUT =203, | ||
STATS =206, | STATS =206, | ||
TOP =207, | TOP =207, | ||
UPTIME =208, | UPTIME =208, | ||
MYLIST_ENTRY_ADDED =210, | MYLIST_ENTRY_ADDED =210, | ||
ENTRY_DELETED =211, | ENTRY_DELETED =211, | ||
FILE =220, | FILE =220, | ||
MYLIST =221, | MYLIST =221, | ||
MYLIST_STATS =222, | MYLIST_STATS =222, | ||
ANIME =230, | ANIME =230, | ||
ANIME_BEST_MATCH =231, | ANIME_BEST_MATCH =231, | ||
RANDOMANIME =232, | RANDOMANIME =232, | ||
EPISODE =240, | EPISODE =240, | ||
GROUP =250, | GROUP =250, | ||
VOTED =260, | VOTED =260, | ||
VOTE_FOUND =261, | VOTE_FOUND =261, | ||
VOTE_UPDATED =262, | VOTE_UPDATED =262, | ||
VOTE_REVOKED =263, | VOTE_REVOKED =263, | ||
NOTIFICATION_ENABLED =270, | NOTIFICATION_ENABLED =270, | ||
PUSHACK_CONFIRMED =280, | NOTIFICATION_N =271, | ||
NOTIFYACK_SUCCESSFUL_M =281, | NOTIFICATION_M =272, | ||
NOTIFYACK_SUCCESSFUL_N =282, | PUSHACK_CONFIRMED =280, | ||
NOTIFICATION =290, | NOTIFYACK_SUCCESSFUL_M =281, | ||
NOTIFYLIST =291, | NOTIFYACK_SUCCESSFUL_N =282, | ||
NOTIFYGET_MESSAGE =292, | NOTIFICATION =290, | ||
NOTIFYGET_NOTIFY =293, | NOTIFYLIST =291, | ||
SENDMSG_SUCCESSFUL =294, | NOTIFYGET_MESSAGE =292, | ||
NOTIFYGET_NOTIFY =293, | |||
SENDMSG_SUCCESSFUL =294, | |||
/* | /* | ||
* AFFIRMATIVE/NEGATIVE 3XX | * AFFIRMATIVE/NEGATIVE 3XX | ||
*/ | */ | ||
PONG =300, | PONG =300, | ||
FILE_ALREADY_IN_MYLIST =310, | FILE_ALREADY_IN_MYLIST =310, | ||
MYLIST_ENTRY_EDITED =311, | MYLIST_ENTRY_EDITED =311, | ||
NO_SUCH_FILE =320, | NO_SUCH_FILE =320, | ||
NO_SUCH_ENTRY =321, | NO_SUCH_ENTRY =321, | ||
MULTIPLE_FILES_FOUND =322, | MULTIPLE_FILES_FOUND =322, | ||
NO_SUCH_ANIME =330, | NO_SUCH_ANIME =330, | ||
NO_SUCH_EPISODE =340, | NO_SUCH_EPISODE =340, | ||
NO_SUCH_GROUP =350, | NO_SUCH_GROUP =350, | ||
NO_SUCH_VOTE =360, | NO_SUCH_VOTE =360, | ||
INVALID_VOTE_TYPE =361, | INVALID_VOTE_TYPE =361, | ||
INVALID_VOTE_VALUE =362, | INVALID_VOTE_VALUE =362, | ||
PERMVOTE_NOT_ALLOWED =363, | PERMVOTE_NOT_ALLOWED =363, | ||
ALREADY_PERMVOTED =364, | ALREADY_PERMVOTED =364, | ||
NOTIFICATION_DISABLED =370, | NOTIFICATION_DISABLED =370, | ||
NO_SUCH_PACKET_PENDING =380, | NO_SUCH_PACKET_PENDING =380, | ||
NO_SUCH_ENTRY_M =381, | NO_SUCH_ENTRY_M =381, | ||
NO_SUCH_ENTRY_N =382, | NO_SUCH_ENTRY_N =382, | ||
NO_SUCH_MESSAGE =392, | NO_SUCH_MESSAGE =392, | ||
NO_SUCH_NOTIFY =393, | NO_SUCH_NOTIFY =393, | ||
NO_SUCH_USER =394, | NO_SUCH_USER =394, | ||
NO_SUCH_DATA_ENTRY =396, | NO_SUCH_DATA_ENTRY =396, | ||
/* | /* | ||
Line 929: | Line 930: | ||
*/ | */ | ||
NOT_LOGGED_IN =403, | NOT_LOGGED_IN =403, | ||
NO_SUCH_MYLIST_FILE =410, | NO_SUCH_MYLIST_FILE =410, | ||
NO_SUCH_MYLIST_ENTRY =411, | NO_SUCH_MYLIST_ENTRY =411, | ||
Line 938: | Line 939: | ||
*/ | */ | ||
LOGIN_FAILED =500, | LOGIN_FAILED =500, | ||
LOGIN_FIRST =501, | LOGIN_FIRST =501, | ||
ACCESS_DENIED =502, | ACCESS_DENIED =502, | ||
CLIENT_VERSION_OUTDATED =503, | CLIENT_VERSION_OUTDATED =503, | ||
CLIENT_BANNED =504, | CLIENT_BANNED =504, | ||
ILLEGAL_INPUT_OR_ACCESS_DENIED =505, | ILLEGAL_INPUT_OR_ACCESS_DENIED =505, | ||
INVALID_SESSION =506, | INVALID_SESSION =506, | ||
BANNED =555, | BANNED =555, | ||
UNKNOWN_COMMAND =598, | UNKNOWN_COMMAND =598, | ||
/* | /* | ||
Line 952: | Line 953: | ||
*/ | */ | ||
INTERNAL_SERVER_ERROR =600, | INTERNAL_SERVER_ERROR =600, | ||
ANIDB_OUT_OF_SERVICE =601, | ANIDB_OUT_OF_SERVICE =601, | ||
API_VIOLATION =666, | API_VIOLATION =666, | ||
</pre> | </pre> | ||