UDP API Definition: Difference between revisions

reported by darsh
(reported by darsh)
Line 19: Line 19:


=== Content Encoding ===
=== Content Encoding ===
:* Current character encoding used by the api: '''unknown'''
:* 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 & and = in your option values in html form encoding style before sending them to the api server. All other html form encodings are optional.
:: 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/recieve any anidb api packets for the next >= 30 minutes.
* 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 the communication. NOTIFICATIONs will '''never''' have tags.
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}
* 501 LOGIN FIRST


'''Info:'''
'''Info:'''
Line 320: Line 319:
: {str type}|{int4 id}
: {str type}|{int4 id}
: ...
: ...
* 501 LOGIN FIRST


'''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
always
* 505 ILLEGAL INPUT OR ACCESS DENIED
* 501 LOGIN FIRST


'''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
* 505 ILLEGAL INPUT OR ACCESS DENIED
* 501 LOGIN FIRST


'''Info:'''
'''Info:'''
Line 384: Line 381:


== Data Commands ==
== Data Commands ==
=== ANIME: Retrieves data for a specific anime ===
=== ANIME: Retrieve Anime Data ===
'''Command String:'''<br>
'''Command String:'''<br>
by aid
by aid
Line 413: Line 410:


----
----
=== EPISODE: Retrieves data for a specific 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: Retrieves data for a specific 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 only works if you are logged in.
* 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 100 chars.
title must not be longer than 50 chars.
body must not be longer than 1200 chars.
body must not be longer than 900 chars.
}}
}}


Line 853: Line 851:
* 598 UNKNOWN COMMAND
* 598 UNKNOWN COMMAND


== RETURN CODES ==
== 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, //C
LOGIN_ACCEPTED =200,
LOGIN_ACCEPTED_NEW_VER =201, //C
LOGIN_ACCEPTED_NEW_VER =201,
LOGGED_OUT =203, //C
LOGGED_OUT =203,
STATS =206, //N
STATS =206,
TOP =207, //N
TOP =207,
UPTIME =208, //N
UPTIME =208,


MYLIST_ENTRY_ADDED =210, //C
MYLIST_ENTRY_ADDED =210,
ENTRY_DELETED =211, //C
ENTRY_DELETED =211,


FILE =220, //C
FILE =220,
MYLIST =221, //C
MYLIST =221,
MYLIST_STATS =222, //N
MYLIST_STATS =222,


ANIME =230, //N
ANIME =230,
ANIME_BEST_MATCH =231, //N
ANIME_BEST_MATCH =231,
RANDOMANIME =232, //N
RANDOMANIME =232,


EPISODE =240, //N
EPISODE =240,
GROUP =250, //N
GROUP =250,


VOTED =260, //N
VOTED =260,
VOTE_FOUND =261, //N
VOTE_FOUND =261,
VOTE_UPDATED =262, //N
VOTE_UPDATED =262,
VOTE_REVOKED =263, //N
VOTE_REVOKED =263,


NOTIFICATION_ENABLED =270, //C
NOTIFICATION_ENABLED =270,
PUSHACK_CONFIRMED =280, //C
NOTIFICATION_N =271,
NOTIFYACK_SUCCESSFUL_M =281, //C
NOTIFICATION_M =272,
NOTIFYACK_SUCCESSFUL_N =282, //C
PUSHACK_CONFIRMED =280,
NOTIFICATION =290, //C
NOTIFYACK_SUCCESSFUL_M =281,
NOTIFYLIST =291, //C
NOTIFYACK_SUCCESSFUL_N =282,
NOTIFYGET_MESSAGE =292, //C
NOTIFICATION =290,
NOTIFYGET_NOTIFY =293, //C
NOTIFYLIST =291,
SENDMSG_SUCCESSFUL =294, //C
NOTIFYGET_MESSAGE =292,
NOTIFYGET_NOTIFY =293,
SENDMSG_SUCCESSFUL =294,


/*
/*
  * AFFIRMATIVE/NEGATIVE 3XX
  * AFFIRMATIVE/NEGATIVE 3XX
  */
  */
PONG =300, //C
PONG =300,
FILE_ALREADY_IN_MYLIST =310, //C
FILE_ALREADY_IN_MYLIST =310,
MYLIST_ENTRY_EDITED =311, //C
MYLIST_ENTRY_EDITED =311,
NO_SUCH_FILE =320, //C
NO_SUCH_FILE =320,
NO_SUCH_ENTRY =321, //C
NO_SUCH_ENTRY =321,
MULTIPLE_FILES_FOUND =322, //N
MULTIPLE_FILES_FOUND =322,


NO_SUCH_ANIME =330, //N
NO_SUCH_ANIME =330,
NO_SUCH_EPISODE =340, //N
NO_SUCH_EPISODE =340,
NO_SUCH_GROUP =350, //N
NO_SUCH_GROUP =350,


NO_SUCH_VOTE =360, //N
NO_SUCH_VOTE =360,
INVALID_VOTE_TYPE =361, //N
INVALID_VOTE_TYPE =361,
INVALID_VOTE_VALUE =362, //N
INVALID_VOTE_VALUE =362,
PERMVOTE_NOT_ALLOWED =363, //N
PERMVOTE_NOT_ALLOWED =363,
ALREADY_PERMVOTED =364, //N
ALREADY_PERMVOTED =364,


NOTIFICATION_DISABLED =370, //C
NOTIFICATION_DISABLED =370,
NO_SUCH_PACKET_PENDING =380, //C
NO_SUCH_PACKET_PENDING =380,
NO_SUCH_ENTRY_M =381, //C
NO_SUCH_ENTRY_M =381,
NO_SUCH_ENTRY_N =382, //C
NO_SUCH_ENTRY_N =382,


NO_SUCH_MESSAGE =392, //C
NO_SUCH_MESSAGE =392,
NO_SUCH_NOTIFY =393, //C
NO_SUCH_NOTIFY =393,
NO_SUCH_USER =394, //C
NO_SUCH_USER =394,


NO_SUCH_DATA_ENTRY =396, //N
NO_SUCH_DATA_ENTRY =396,


/*
/*
Line 929: Line 930:
  */
  */


NOT_LOGGED_IN =403, //C
NOT_LOGGED_IN =403,
NO_SUCH_MYLIST_FILE =410, //C
NO_SUCH_MYLIST_FILE =410,
NO_SUCH_MYLIST_ENTRY =411, //C
NO_SUCH_MYLIST_ENTRY =411,




Line 938: Line 939:
  */
  */


LOGIN_FAILED =500, //C
LOGIN_FAILED =500,
LOGIN_FIRST =501, //C
LOGIN_FIRST =501,
ACCESS_DENIED =502, //C
ACCESS_DENIED =502,
CLIENT_VERSION_OUTDATED =503, //C
CLIENT_VERSION_OUTDATED =503,
CLIENT_BANNED =504, //C
CLIENT_BANNED =504,
ILLEGAL_INPUT_OR_ACCESS_DENIED =505, //C
ILLEGAL_INPUT_OR_ACCESS_DENIED =505,
INVALID_SESSION =506, //C
INVALID_SESSION =506,
BANNED =555, //N
BANNED =555,
UNKNOWN_COMMAND =598, //C
UNKNOWN_COMMAND =598,


/*
/*
Line 952: Line 953:
  */
  */


INTERNAL_SERVER_ERROR =600, //C
INTERNAL_SERVER_ERROR =600,
ANIDB_OUT_OF_SERVICE =601, //C
ANIDB_OUT_OF_SERVICE =601,
API_VIOLATION =666, //C
API_VIOLATION =666,
</pre>
</pre>


546

edits

MediaWiki spam blocked by CleanTalk.
MediaWiki spam blocked by CleanTalk.