UDP API Definition: Difference between revisions

no edit summary
mNo edit summary
No edit summary
Line 1: Line 1:
'''Author:''' [[User:Exp|Exp]]<br>
'''Author:''' [[User:Exp|Exp]]<br>
'''Version:''' 0.02c - 10.10.2004 <br>
'''Version:''' 0.03 - 13.01.2006 <br>
'''Version number used for protover parameter:''' "2"
'''Version number used for protover parameter:''' "3"


Updated versions of this document, notifications and official clients:
Updated versions of this document, notifications and official clients:
Line 11: Line 11:


== Changelog ==
== Changelog ==
  0.02c - 10.10.2004
<pre>
  LOGOUT now requires the session string too
0.03 - 13.01.2006
  Note on 6xx server errors and tags added
ANIME, EPISODE, GROUP, STATS, TOP, UPTIME, MYLISTSTATS, VOTE and RANDOM commands added
 
it is now possible to use html escaped code in mylist fields, and '='
  0.02b - 14.08.2004
updated epno in default file name (for new specials)
  503 INVALID SESSION changed to 506 INVALID SESSION
... (a lot of stuff already forgotten)
  BUGFIX: 200 message on AUTH did not contain a session key
  BUGFIX: 1 internal bug fixed
 
  0.02 - 13.08.2004
  new session key needs to be send with each command
  random udp ports no longer required
  FILE, MYLIST, MYLISTDEL, MYLISTADD commands added
  Some textparts of return values changed
  additional documentation added
  check the caching section!
 
  0.01b - 12.08.2004
  added NOTIFYLIST, NOTIFYGET, NOTIFYACK, SENDMSG commands
 
  0.01 - 10.08.2004
  initial version


0.02c - 10.10.2004
LOGOUT now requires the session string too
Note on 6xx server errors and tags added
0.02b - 14.08.2004
503 INVALID SESSION changed to 506 INVALID SESSION
BUGFIX: 200 message on AUTH did not contain a session key
BUGFIX: 1 internal bug fixed
0.02 - 13.08.2004
new session key needs to be send with each command
random udp ports no longer required
FILE, MYLIST, MYLISTDEL, MYLISTADD commands added
Some textparts of return values changed
additional documentation added
check the caching section!
0.01b - 12.08.2004
added NOTIFYLIST, NOTIFYGET, NOTIFYACK, SENDMSG commands
0.01 - 10.08.2004
initial version
</pre>


== Formats used in this Spec ==
== Formats used in this Spec ==
Line 50: Line 57:
:* All newlines should be replaced by &lt;br&gt;
:* All newlines should be replaced by &lt;br&gt;
:: escape scheme for returned data fields: ', | and newline
:: escape scheme for returned data fields: ', | and newline
:: newlines are encoded as &lt;br&gt;, | is not allowed in data fields and ' is encoded as ´.  
:: newlines are encoded as &lt;br&gt;, | is not allowed in data fields and ' is encoded as ?.




== Basics ==
== Basics ==
=== General ===
* All commands except PING requires login, meaning session tag must be set (s=xxxxx).
* Possible return codes for all commands:
:* 600 INTERNAL SERVER ERROR
:* 601 ANIDB OUT OF SERVICE - TRY AGAIN LATER
:* 505 ILLEGAL INPUT OR ACCESS DENIED
:* 598 UNKNOWN COMMAND (sort of)
* Additional return codes for all commands that require login:
:* 501 LOGIN FIRST
:* 506 INVALID SESSION
* General return data:
  {three digit return code} {str return string}\n
  {data field 0}|{data field 1}|...|{data field n}
* Exceptions are 200,201,271,272,504 which returns additional data in the first line.


=== IDs ===
=== IDs ===
All IDs start at 1 (not 0).
All IDs start at 1 (not 0).
A normal table index (id) may never be 0 (there are some exceptions where an entry with id=0 exists, however those represent unknown values)
A normal table index (id) may never be 0 (there are some exceptions where an entry with id=0 exists, however those represent unknown values)
Line 70: Line 93:
Due to the length contraints of an UDP package API replies might be truncated at the end if they exceed the max. length of ~1500 bytes. Such events are not handled specially, the data will simply be sent truncated.
Due to the length contraints of an UDP package API replies might be truncated at the end if they exceed the max. length of ~1500 bytes. Such events are not handled specially, the data will simply be sent truncated.
}}
}}


=== Server / UDP Connection: ===
=== Server / UDP Connection: ===
The Client has to send data packets to:  
The Client has to send data packets to:
: '''Server:''' api.anidb.info
: '''Server:''' api.anidb.info
: '''Port:''' 9000/UDP
: '''Port:''' 9000/UDP
Line 81: Line 105:
While in daily maintenance the AniDB API will reply with
While in daily maintenance the AniDB API will reply with


601 ANIDB OUT OF SERVICE - TRY AGAIN LATER  
601 ANIDB OUT OF SERVICE - TRY AGAIN LATER


to all commands.
to all commands.
Line 115: Line 139:
=== Flood Protection ===
=== Flood Protection ===
To prevent high server load the UDP API server enforces a strict flood protection policy.
To prevent high server load the UDP API server enforces a strict flood protection policy.
:* Short Term:  
:* Short Term:
:: A Client MUST NOT send more than 0.5 packets per second.
:: A Client MUST NOT send more than 0.5 packets per second.
:: The server will start to enforce the limit after the first 5 packets have been recieved.
:: The server will start to enforce the limit after the first 5 packets have been recieved.
:* Long Term:  
:* Long Term:
:: A Client MUST NOT send more than one packet every 30 seconds over an extended amount of time.
:: A Client MUST NOT send more than one packet every 30 seconds over an extended amount of time.


Line 161: Line 185:


=== Server Errors ===
=== Server Errors ===
At any time the API might return a fatal error of the form:  
At any time the API might return a fatal error of the form:
:* 6xx ERROR DESCRIPTION  
:* 6xx ERROR DESCRIPTION
Possible codes are 600-699.
Possible codes are 600-699.


Line 169: Line 193:




== Commands ==
== Authing Commands ==
{{eyecatch|NOTE:| _ANY_ command which requires parameters may return: 505 ILLEGAL INPUT OR ACCESS DENIED  
{{eyecatch|NOTE:| _ANY_ command which requires parameters may return: 505 ILLEGAL INPUT OR ACCESS DENIED
}}
}}


Line 176: Line 200:
=== AUTH: Authing to the AnimeDB ===
=== AUTH: Authing to the AnimeDB ===
'''Command String:'''
'''Command String:'''
:* AUTH user={str username}&pass={str password}&protover={int4 apiversion}&client={str clientname}&clientver={int4 clientversion}  
* AUTH user={str username}&pass={str password}&protover={int4 apiversion}&client={str clientname}&clientver={int4 clientversion}


'''Possible Replies:'''
'''Possible Replies:'''
:* 200 {str session_key} LOGIN ACCEPTED  
* 200 {str session_key} LOGIN ACCEPTED
:* 201 {str session_key} LOGIN ACCEPTED - NEW VERSION AVAILABLE  
* 201 {str session_key} LOGIN ACCEPTED - NEW VERSION AVAILABLE
:* 500 LOGIN FAILED  
* 500 LOGIN FAILED
:* 503 CLIENT VERSION OUTDATED  
* 503 CLIENT VERSION OUTDATED
:* 504 CLIENT BANNED - {str reason}  
* 504 CLIENT BANNED - {str reason}
:* 505 ILLEGAL INPUT OR ACCESS DENIED  
* 505 ILLEGAL INPUT OR ACCESS DENIED
:* 601 ANIDB OUT OF SERVICE - TRY AGAIN LATER  
* 601 ANIDB OUT OF SERVICE - TRY AGAIN LATER


'''IMPORTANT! POSSIBLE RETURN CODE AT ANY POINT OF THE API PROTOCOL:'''
'''IMPORTANT! POSSIBLE RETURN CODE AT ANY POINT OF THE API PROTOCOL:'''
:* 501 LOGIN FIRST  
* 501 LOGIN FIRST
:* 502 ACCESS DENIED  
* 502 ACCESS DENIED
:* 506 INVALID SESSION  
* 506 INVALID SESSION


'''Info:'''
'''Info:'''
:* The ''session_key'' is a String containing only ''a-z,A-Z,0-9'' chars of a length of ''4-8'' characters.
* The ''session_key'' is a String containing only ''a-z,A-Z,0-9'' chars of a length of ''4-8'' characters.
:: It has to be stored by the client and needs to be sent as parameter with every command which requires the user to logged in.
: It has to be stored by the client and needs to be sent as parameter with every command which requires the user to logged in.
:* The ''session_key'' String is appended as parameter "s", i.e. "PUSH notify=1&msg=1&s={str session_key}".
* The ''session_key'' String is appended as parameter "s", i.e. "PUSH notify=1&msg=1&s={str session_key}".
:* On a '''500 LOGIN FAILED''' message the client should request the user to enter username and password again.
* On a '''500 LOGIN FAILED''' message the client should request the user to enter username and password again.
:* In case of a '''501 LOGIN FIRST''' message the client should silently resend an auth command and send the failed command again.
* In case of a '''501 LOGIN FIRST''' message the client should silently resend an auth command and send the failed command again.
:* A '''502 ACCESS DENIED''' message should abort the current action on the client side and display a message to the user.
* A '''502 ACCESS DENIED''' message should abort the current action on the client side and display a message to the user.
:* A '''506 INVALID SESSION''' means that either the session key parameter "s" was not provided with a command that requires it or the session key is no longer valid. The client should reissue an AUTH command.
* A '''506 INVALID SESSION''' means that either the session key parameter "s" was not provided with a command that requires it or the session key is no longer valid. The client should reissue an AUTH command.
{{eyecatch|NOTE:| A frontend shall expect 501 and 502 messages to be returned on ANY command.}}
{{eyecatch|NOTE:| A frontend shall expect 501 and 502 messages to be returned on ANY command.}}
{{eyecatch|NOTE:| Anidb usernames are always lowercase and may only contain characters (a-z) and numbers (0-9).}}
{{eyecatch|NOTE:| Anidb usernames are always lowercase and may only contain characters (a-z) and numbers (0-9).}}
:* The client should silently convert all entered usernames to lowercase before sending them to the API.
* The client should silently convert all entered usernames to lowercase before sending them to the API.
:* The client should send the apiversion of the AnimeDB API version it supports as value of the protover parameter.
* The client should send the apiversion of the AnimeDB API version it supports as value of the protover parameter.
:* The client MAY NOT send anything but the version of the API Specs the author used to write the client! (as it is stated at the top of this file @ "Version number used for protover parameter")
* The client MAY NOT send anything but the version of the API Specs the author used to write the client! (as it is stated at the top of this file @ "Version number used for protover parameter")
:: The API will compare that value to it's own version of the API and if the version of the client is older the API will decide wheter the changes were significant enough to deny the old client access to the DB.
: The API will compare that value to it's own version of the API and if the version of the client is older the API will decide wheter the changes were significant enough to deny the old client access to the DB.
:* The clientname shall be a lowercase string containing only the chars ''a-z'' of ''4-16 chars'' length which identifies the client. (i.e. mykickassclient)
* The clientname shall be a lowercase string containing only the chars ''a-z'' of ''4-16 chars'' length which identifies the client. (i.e. mykickassclient)
:* The clientversion shall be a number starting with 1, increased on every change in the client.
* The clientversion shall be a number starting with 1, increased on every change in the client.
:: clientname and clientversion might be used by the API to distinguish between different clients and client versions if that should ever become nessecary.
: clientname and clientversion might be used by the API to distinguish between different clients and client versions if that should ever become nessecary.
{{eyecatch|IMPORTANT:|
{{eyecatch|IMPORTANT:|
:* DO NOT use the clientname of another existing client.
* DO NOT use the clientname of another existing client.
:* ALWAYS increase the clientversion number if you release a new client version.
* ALWAYS increase the clientversion number if you release a new client version.
}}
}}
:* A Login and its assigned ''session_key'' is valid until the virtual UDP connection times out or until a LOGOUT command is issued.
* A Login and its assigned ''session_key'' is valid until the virtual UDP connection times out or until a LOGOUT command is issued.
:* The virtual UDP connection times out if no data was recieved from the client for '''35 minutes'''.
* The virtual UDP connection times out if no data was recieved from the client for '''35 minutes'''.
:* A client should issue a NOTIFY command once every 30 minutes to keep the connection alive should that be required.
* A client should issue a NOTIFY command once every 30 minutes to keep the connection alive should that be required.
:* If the client does not use any of the notification/push features of the API it should NOT keep the connection alive, furthermore it should explicitly terminate the connection by issueing a LOGOUT command once it finished it's work.
* If the client does not use any of the notification/push features of the API it should NOT keep the connection alive, furthermore it should explicitly terminate the connection by issueing a LOGOUT command once it finished it's work.
:* If it is very likely that another command will be issued shortly (within the next 20 minutes) a client may keep the current connection open, until it times out on it's own, by not sending a LOGOUT command.
* If it is very likely that another command will be issued shortly (within the next 20 minutes) a client may keep the current connection open, until it times out on it's own, by not sending a LOGOUT command.
:* The client shall notify the user if it recieved a 201 message at login.
* The client shall notify the user if it recieved a 201 message at login.
:: This means a new version of the client is available, however the old version is still supported otherwise a client banned message would have been returned.
: This means a new version of the client is available, however the old version is still supported otherwise a client banned message would have been returned.
:* The user should get a popup message on 503 and 504 messages telling him to update his client software.
* The user should get a popup message on 503 and 504 messages telling him to update his client software.
:: (NOTE: 504 means that this version of the client is banned, not the user!)
: (NOTE: 504 means that this version of the client is banned, not the user!)
{{eyecatch|IMPORTANT:| Make sure your client handels ALL possible AUTH return codes before giving out any versions!}}
{{eyecatch|IMPORTANT:| Make sure your client handels ALL possible AUTH return codes before giving out any versions!}}


----
----
=== LOGOUT: Logout ===
=== LOGOUT: Logout ===
'''Command String:'''
'''Command String:'''
:* LOGOUT  
* LOGOUT


'''Possible Replies:'''
'''Possible Replies:'''
:* 203 LOGGED OUT
* 203 LOGGED OUT
:* 403 NOT LOGGED IN  
* 403 NOT LOGGED IN


'''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/recieve any anidb api packets for the next >= 30 minutes.


----
== Notify Commands ==
=== PUSH: UDP Notification Registration ===
=== PUSH: UDP Notification Registration ===
'''Command String:'''
'''Command String:'''
:* PUSH notify={bool push_file_added_notifications}&msg={bool push_msg_added_notifications}  
* PUSH notify={bool push_file_added_notifications}&msg={bool push_msg_added_notifications}


'''Possible Replies:'''
'''Possible Replies:'''
:* 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:'''
:* This command only works if you are logged in.
* This command only works if you are logged in.
:* With this command you can register your client as an observer for anidb notification and message events for the current user. If you are registered for one or both events the anidb server will send an UDP packet (format see below) on each change which affects the current user. The UDP packet is sent to the ip and port from which the AUTH command was recieved.
* With this command you can register your client as an observer for anidb notification and message events for the current user. If you are registered for one or both events the anidb server will send an UDP packet (format see below) on each change which affects the current user. The UDP packet is sent to the ip and port from which the AUTH command was recieved.
:* UDP packets are resend 3 times, if the client does not acknowlege them. After that the client is logged out and no further notifies will be sent.
* UDP packets are resend 3 times, if the client does not acknowlege them. After that the client is logged out and no further notifies will be sent.
:* On recieving any of the above packets the client has to issue a PUSHACK command with the notify_packet_id provided in the notification packet.
* On recieving any of the above packets the client has to issue a PUSHACK command with the notify_packet_id provided in the notification packet.


'''Notification Packet Format:'''
'''Notification Packet Format:'''
:* File Added Notify:
* File Added Notify:


   271 {'''int4''' notify_packet_id} NOTIFICATION
   271 {'''int4''' notify_packet_id} NOTIFICATION
   {int4 aid}|{int4 date}|{int4 count}|{str animetitle}  
   {int4 aid}|{int4 date}|{int4 count}|{str animetitle}


:: aid is the id of the affected anime
: aid is the id of the affected anime
:: date is the time of the event (in seconds since 1.1.1970)
: date is the time of the event (in seconds since 1.1.1970)
:: count is the number of events pending for this anime
: count is the number of events pending for this anime
:: animetitle is the name of the affected anime
: animetitle is the name of the affected anime


:* Message Added Notify:
* Message Added Notify:


   272 {int4 notify_packet_id} NOTIFICATION
   272 {int4 notify_packet_id} NOTIFICATION
   {int2 type}|{int4 date}|{int4 senderuid}|{str sendername}|{str subject}  
   {int2 type}|{int4 date}|{int4 senderuid}|{str sendername}|{str subject}


:: type is the type of the message (0=normal msg, 1=annonymous, 2=system msg, 3=mod msg)
: type is the type of the message (0=normal msg, 1=annonymous, 2=system msg, 3=mod msg)
:: date is the time the message was sent (in seconds since 1.1.1970)
: date is the time the message was sent (in seconds since 1.1.1970)
:: senderuid/sendername are the user id and username of the sender
: senderuid/sendername are the user id and username of the sender
:: subject is the message subject
: subject is the message subject


----
----
=== PUSHACK: UDP Notification Acknowledge ===
=== PUSHACK: UDP Notification Acknowledge ===
'''Command String:'''
'''Command String:'''
:* PUSHACK nid={int4 notify_packet_id}  
* PUSHACK nid={int4 notify_packet_id}


'''Possible Replies:'''
'''Possible Replies:'''
:* 280 PUSHACK CONFIRMED
* 280 PUSHACK CONFIRMED
:* 380 NO SUCH PACKET PENDING
* 380 NO SUCH PACKET PENDING


'''Info:'''
'''Info:'''
:* This command only works if you are logged in.
* This command only works if you are logged in.
 
*see: '''PUSH'''
see: '''PUSH'''
 


----
----
=== NOTIFY: Notifications ===
=== NOTIFY: Notifications ===
'''Command String:'''
'''Command String:'''
:* NOTIFY  
* NOTIFY


'''Possible Replies:'''
'''Possible Replies:'''
:* 290 NOTIFICATION
* 290 NOTIFICATION
:: {int4 pending_notifies}|{int4 pending_msgs}  
: {int4 pending_notifies}|{int4 pending_msgs}
:* 501 LOGIN FIRST  
* 501 LOGIN FIRST


'''Info:'''
'''Info:'''
:* This command only works if you are logged in.
* This command only works if you are logged in.
:* pending_notifies number of animes which have pending notifications for this user.
* pending_notifies number of animes which have pending notifications for this user.
:* pending_msgs number of unread anidb messages for this user.
* pending_msgs number of unread anidb messages for this user.
:* A client which has registered to recieve UDP notification packets should issue this command once every 30 minutes to keep the connection alive and to ensure that it has not been logged out by the API server yet.
* A client which has registered to recieve UDP notification packets should issue this command once every 30 minutes to keep the connection alive and to ensure that it has not been logged out by the API server yet.
:* If the client did send a NOTIFY within the last 35 minutes and it was confirmed by AniDB then recieving a 501 LOGIN FIRST message for the next NOTIFY command shows that AniDB logged the client out bc it did not respond to a PUSH Notification packet.
* If the client did send a NOTIFY within the last 35 minutes and it was confirmed by AniDB then recieving a 501 LOGIN FIRST message for the next NOTIFY command shows that AniDB logged the client out bc it did not respond to a PUSH Notification packet.
:* There is no command to retrieve missed PUSH Notifications.
* There is no command to retrieve missed PUSH Notifications.
{{eyecatch|NOTE:| This command MUST NOT be issued more than once every 20 minutes.}}
{{eyecatch|NOTE:| This command MUST NOT be issued more than once every 20 minutes.}}


----
----
=== NOTIFYLIST: List Notification/Message IDs ===
=== NOTIFYLIST: List Notification/Message IDs ===
'''Command String:'''
'''Command String:'''
:* NOTIFYLIST  
* NOTIFYLIST


'''Possible Replies:'''
'''Possible Replies:'''
:*291 NOTIFYLIST
*291 NOTIFYLIST
:: {str type}|{int4 id}
: {str type}|{int4 id}
:: {str type}|{int4 id}
: {str type}|{int4 id}
:: ...  
: ...
:* 501 LOGIN FIRST  
* 501 LOGIN FIRST


'''Info:'''
'''Info:'''
:* This command only works if you are logged in.
* This command only works if you are logged in.
:* type is:
* type is:
:: M for message entries
: M for message entries
:: N for notification entries
: N for notification entries
:*id is the identifier for the notification/message as required by NOTIFYGET.
*id is the identifier for the notification/message as required by NOTIFYGET.
:* NOTIFYLIST returns one line per entry, if no entries are available only the first line of the reply is returned.
* NOTIFYLIST returns one line per entry, if no entries are available only the first line of the reply is returned.
{{eyecatch|NOTE:| This command MUST NOT be issued regulary but should only be triggered by either a push message recieved by the client or a reply to a NOTIFY command which tells you that there are messages/notifications waiting.}}
{{eyecatch|NOTE:| This command MUST NOT be issued regulary but should only be triggered by either a push message recieved by the client or a reply to a NOTIFY command which tells you that there are messages/notifications waiting.}}


----
----
=== NOTIFYGET: Get Notification/Message ===
=== NOTIFYGET: Get Notification/Message ===
'''Command String:'''
'''Command String:'''
:* NOTIFYGET type={str type}&id={int4 id}  
* NOTIFYGET type={str type}&id={int4 id}


'''Possible Replies:'''
'''Possible Replies:'''
:* 292 NOTIFYGET
* 292 NOTIFYGET
: [if type = M]
[if type = M]
:: {int4 id}|{int4 from_user_id}|{str from_user_name}|{int4 date}|{int4 type}|{str title}|{str body}  
: {int4 id}|{int4 from_user_id}|{str from_user_name}|{int4 date}|{int4 type}|{str title}|{str body}
: [if type = N]
[if type = N]
:: {int4 aid}|{int4 type}|{str count}|{int4 date}|{str anime_name}  
: {int4 aid}|{int4 type}|{str count}|{int4 date}|{str anime_name}
:* 393 NO SUCH ENTRY  
* 393 NO SUCH ENTRY
:* 505 ILLEGAL INPUT OR ACCESS DENIED
* 505 ILLEGAL INPUT OR ACCESS DENIED
:* 501 LOGIN FIRST
* 501 LOGIN FIRST


'''Info:'''
'''Info:'''
:* This command only works if you are logged in.
* This command only works if you are logged in.
:* type is:
* type is:
:: M for message entries
: M for message entries
:: N for notification entries
: N for notification entries
:* id is the identifier for the notification/message as required by NOTIFYGET.
* id is the identifier for the notification/message as required by NOTIFYGET.
:* for message entries (M):
* for message entries (M):
:: date is the time of the event (in seconds since 1.1.1970)
: date is the time of the event (in seconds since 1.1.1970)
:: type is the type of the message (0=normal msg, 1=annonymous, 2=system msg, 3=mod msg)
: type is the type of the message (0=normal msg, 1=annonymous, 2=system msg, 3=mod msg)
:* for notification entries (N):
* for notification entries (N):
:: aid is the id of the affected anime
: aid is the id of the affected anime
:: type is the notification type (0=all, 1=new, 2=group)
: type is the notification type (0=all, 1=new, 2=group)
:: count is the number of events pending for this anime
: count is the number of events pending for this anime
:: date is the time of the event (in seconds since 1.1.1970)
: date is the time of the event (in seconds since 1.1.1970)
 


----
----
=== NOTIFYACK: Ack Notification/Message ===
=== NOTIFYACK: Ack Notification/Message ===
'''Command String:'''
'''Command String:'''
:* NOTIFYACK type={str type}&id={int4 id}  
* NOTIFYACK type={str type}&id={int4 id}


'''Possible Replies:'''
'''Possible Replies:'''
:* 282 NOTIFYACK SUCCESSFUL  
* 282 NOTIFYACK SUCCESSFUL
:* 382 NO SUCH ENTRY  
* 382 NO SUCH ENTRY
:* 505 ILLEGAL INPUT OR ACCESS DENIED  
* 505 ILLEGAL INPUT OR ACCESS DENIED
:* 501 LOGIN FIRST  
* 501 LOGIN FIRST


'''Info:'''
'''Info:'''
:* This command only works if you are logged in.
* This command only works if you are logged in.
:* This command will mark a message read or clear a notification.
* This command will mark a message read or clear a notification.
:* type is:
* type is:
:: M for message entries
: M for message entries
:: N for notification entries
: N for notification entries
 
 
== Data Commands ==
=== ANIME: Retrieves data for a specific anime ===
'''Command String:'''<br>
by aid
* ANIME aid={int4 id}
by name
* ANIME aname={str anime name}
 
'''Possible Replies:'''
* 230 ANIME
: {int4 aid}|{int4 eps}|{int4 ep count}|{int4 special cnt}|{int4 rating}|{int4 votes}|{int4 tmprating}|{int4 tmpvotes}|{int4 review rating average}|{int4 reviews}|{str year}|{str type}|{str romaji}|{str kanji}|{str english}|{str other}|{str short names}|{str synonyms}|{str category list}
* 330 NO SUCH ANIME
 
'''Info:'''
* Synonyms and short names are separated with '
* Category names are separated with ',' and ordered by weight (desc).
* No support for genres.
* By name: must be perfect match of romaji/kanji/english/other/synonym/short name.
* NOTE: The category list is the first data to be truncated if needed. And then: synonym list, short name list. This applies for the FILE command too.
 
'''Examples:''' (html escaped code intended)
  > ANIME aname=tmm&s=xxxxx
  < 230 ANIME
  161|52|50|0|715|57|777|35|816|1|2002-2003|TV|Tokyo Mew Mew|&#26481;&#20140;&#12511;&#12517;&#12454;&#12511;&#12517;&#12454;||||TMM'mew|Cat Girls
 
  > ANIME aname=&#12490;&#12523;&#12488;&s=xxxxx
  < 230 ANIME
  239|0|140|2|1000|10|855|3750|803|36|2002-2005|TV|Naruto|&#12490;&#12523;&#12488;||&#1504;&#1488;&#1512;&#1493;&#1496;&#1493;|NARUTO'&#1606;&#1575;&#1585;&#1608;&#1578;&#1608;|naruto tv'ntv|Action,Shounen,Past,...(cut)


----
----
=== SENDMSG: Send Message ===
=== EPISODE: Retrieves data for a specific episode ===
'''Command String:'''
'''Command String:'''<br>
:* SENDMSG to={str username}&title={str title}&body={str body}  
by eid
* EPISODE eid={int4 eid}
by anime and episode number
* EPISODE aname={str anime name}&epno={int4 episode number}
* EPISODE aid={int4 anime id}&epno={int4 episode number}
 
'''Possible Replies:'''
* 240 EPISODE
: {int4 eid}|{int4 aid}|{int4 length}|{int4 rating}|{int4 votes}|{str epno}|{str eng}|{str romaji}|{str kanji}
* 340 NO SUCH EPISODE
 
'''Info:'''
* length is in minutes
* epno includes special character (only if special) and padding (only if normal)
 
'''Examples:''' (html escaped code intended)
  > EPISODE eid=1&s=xxxxx
  < 240 EPISODE
  1|1|24|400|4|01|Invasion|shinryaku|??
 
  > EPISODE aname=Seikai no Monshou&epno=2&s=xxxxx
  < 240 EPISODE
  2|1|24|750|2|02|Kin of the Stars|Hoshi-tachi no Kenzoku|??????
 
----
=== GROUP: Retrieves data for a specific group ===
'''Command String:'''<br>
by gid
* GROUP gid={int4 gid}
by name/shortname
* GROUP gname={str group name}


'''Possible Replies:'''
'''Possible Replies:'''
:* 294 SENDMSG SUCCESSFUL
* 250 GROUP
:* 394 NO SUCH USER
: {int4 gid}|{int4 rating}|{int4 votes}|{int4 acount}|{int fcount}|{str name}|{str short}|{str irc}|{str url}
:* 501 LOGIN FIRST
* 350 NO SUCH GROUP
 
'''Examples:'''
  > GROUP gid=1&s=xxxxx
  < 250 GROUP
  1|621|28|29|222|Animehaven|AH|#animehaven@irc.enterthegame.com|http://www.theanimehaven.com


'''Note:'''
  > GROUP gname=a-l&s=xxxxx
:* This command only works if you are logged in.
  < 250 GROUP
:* This command allows you to send an AniDB message.
  566|860|398|48|503|Anime-Legion|A-L|#anime-legion@irc.irchighway.net|http://www.anime-legion.net
{{eyecatch|IMPORTANT:|
title must not be longer than 100 chars.
body must not be longer than 1200 chars.
}}


----
----
=== FILE: Retrieve File Data ===
=== FILE: Retrieve File Data ===
'''Command String:'''
'''Command String:'''
: query by fid:
by fid:
:* FILE fid={int4 id}  
* FILE fid={int4 id}[&fcode={int4}&acode={int4}]
by size+ed2k hash:
* FILE size={int4 size}&ed2k={str ed2khash}[&fcode={int4}&acode={int4}]
by anime, group and epno
* FILE aname={str anime name}&gname={str group name}&epno={int4 episode number}[&fcode={int4}&acode={int4}]
* FILE aname={str anime name}&gid={int4 group id}&epno={int4 episode number}[&fcode={int4}&acode={int4}]
* FILE aid={int4 anime id}&gname={str group name}&epno={int4 episode number}[&fcode={int4}&acode={int4}]
* FILE aid={int4 anime id}&gid={int4 group id}&epno={int4 episode number}[&fcode={int4}&acode={int4}]
 
'''Possible Replies:'''
* 220 FILE
: {int4 fid}|{int4 aid}|{int4 eid}|{int4 gid}|{int4 state}|{int4 size}|{str ed2k}|{str anidbfilename}
* 220 FILE
: {int4 fid}|...(data list)
* 320 NO SUCH FILE


: query by size+ed2k hash:
'''Info:'''
:* FILE size={int4 size}&ed2k={str ed2khash}
* fid, aid, eid, gid are the unique ids for the file, anime, ep, group entries at anidb.
: You can use those to create links to the corresponding pages at anidb.
* anidbfilename is the anidb filename for the file.
: 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.


'''Possible Replies:'''
'''State:'''
:* 220 FILE
<pre>
:: {int4 fid}|{int4 aid}|{int4 eid}|{int4 gid}|{int4 state}|{int4 size}|{str ed2k}|{str anidbfilename}
bit / int value meaning
1 / 1 FILE_CRCOK: file matched official crc (displayed with green background in anidb)
2 / 2 FILE_CRCERR: file DID NOT match official crc (displayed with red background in anidb)
3 / 4 FILE_ISV2: file is version 2
4 / 8 FILE_ISV3: file is version 3
5 / 16 FILE_ISV4: file is version 4
6 / 32 FILE_ISV5: file is version 5


:* 320 NO SUCH FILE
examples:
state ==== 9 ==> FILE_CRCOK+FILE_ISV3 ==> file matched official crc and is version 3
state ==== 0 ==> - ==> file was not crc checked and is version 1
state ==== 34 ==> FILE_CRCERR+FILE_ISV5 ==> file DID NOT match official crc and is version 5
state ==== 1 ==> FILE_CRCOK ==> file matched official crc and is version 1
state ==== 8 ==> FILE_ISV3 ==> file was not crc checked and is version 3
</pre>


'''Info:'''
'''fcode:'''
:* fid, aid, eid, gid are the unique ids for the file, anime, ep, group entries at anidb.
{| cellpadding="0" align="center"
:: You can use those to create links to the corresponding pages at anidb.
! width="40"|Bit
:* anidbfilename is the anidb filename for the file.
! width="80"|Decimal
:: However this name does not contain all the extra information of the filenames on AniDB and might be composed slightly different.
! width="160"|Data field
! width="50"|-
! width="40"|Bit
! width="80"|Decimal
! width="160"|Data field
|- style="background-color: #eee;"
|0 ||1 || not used || || 16 || 65536 || str dub language
|-
|1 ||2 || int4 aid || || 17 || 131072 || str sub language
|- style="background-color: #eee;"
|2 ||4 || int4 eid || || 18 || 262144 || str quality
|-
|3 ||8 || int4 gid ||  || 19 || 524288 || str source
|- style="background-color: #eee;"
|4 ||16 || int4 lid || || 20 || 1048576 || str audio codec
|-
|5 ||32 || not used || || 21 || 2097152 || int4 audio bitrate
|- style="background-color: #eee;"
|6 ||64 || not used || || 22 || 4194304 || str video codec
|-
|7 ||128 || not used || || 23 || 8388608 || int4 video bitrate
|- style="background-color: #eee;"
|8 ||256 || int2 status || || 24 || 16777216 || str video resolution
|-
|9 ||512 || int4 size || || 25 || 33554432 || str file type (extension)
|- style="background-color: #eee;"
|10 ||1024 || str ed2k || || 26 || 67108864 || int4 length in seconds
|-
|11 ||2048 || str md5 || || 27 || 134217728 || not used
|- style="background-color: #eee;"
|12 ||4096 || str sha1 || || 28 || 268435456 || not used
|-
|13 ||819 || str crc32 || || 29 || 536870912 || not used
|- style="background-color: #eee;"
|14 ||16384 || not used || || 30 || 1073741824 || not used
|-
|15 ||32768 || not used || || 31 || -2147483648 || not used
|}
'''acode:'''
{| cellpadding="0" align="center"
! width="40"|Bit
! width="80"|Decimal
! width="160"|Data field
! width="50"|-
! width="40"|Bit
! width="80"|Decimal
! width="160"|Data field
|- style="background-color: #eee;"
|0 ||1 || str group name || || 16 || 65536 || int4 anime total episodes
|-
|1 ||2 || str group short name || || 17 || 131072 || int4 last episode nr (highest, not special)
|- style="background-color: #eee;"
|2 ||4 || not used || || 18 || 262144 || str year
|-
|3 ||8 || not used ||  || 19 || 524288 || str type
|- style="background-color: #eee;"
|4 ||16 || not used || || 20 || 1048576 || str romaji name
|-
|5 ||32 || not used || || 21 || 2097152 || str kanji name
|- style="background-color: #eee;"
|6 ||64 || not used || || 22 || 4194304 || str english name
|-
|7 ||128 || not used || || 23 || 8388608 || str other name
|- style="background-color: #eee;"
|8 ||256 || str epno || || 24 || 16777216 || str short name list
|-
|9 ||512 || str ep name || || 25 || 33554432 || str synonym list
|- style="background-color: #eee;"
|10 ||1024 || str ep romaji name || || 26 || 67108864 || str category list
|-
|11 ||2048 || str ep kanji name || || 27 || 134217728 || not used
|- style="background-color: #eee;"
|12 ||4096 || not used || || 28 || 268435456 || not used
|-
|13 ||819 || not used || || 29 || 536870912 || not used
|- style="background-color: #eee;"
|14 ||16384 || not used || || 30 || 1073741824 || not used
|-
|15 ||32768 || not used || || 31 || -2147483648 || not used
|}
'''Examples:''' (html escaped code intended)
<pre>
> FILE fid=15201&s=xxxxx
< 220 FILE
15201|74|445|41|1|242772540|a53c401ed95eaa502ba85acde773040c|Ai yori Aoshi - 1 - Relation - [Zhentarim DivX].ogm


:* file state:
> FILE fid=15201&fdata=-1&adata=-1&s=xxxxx
  bit / int value meaning
< 220 FILE
  1 / 1 FILE_CRCOK: file matched official crc (displayed with green background in anidb)
15201|74|445|41|0|1|242772540|a53c401ed95eaa502ba85acde773040c|a69c9ca88822338685f163db95da8231|842fc9060b4338757d0197a9f7bf0c79cf39a549|01ffc5f4|842fc9060b4338757d0197a9f7bf0c79cf39a549|dual (jap/eng)|english|very high|DVD|Ogg Vorbis|101|DivX5|1182|640x480|ogm|Zhentarim DivX|zx|24|24|2002|TV|Ai yori Aoshi|?????|Bluer than Indigo|Azul||aya1'AYA'AiAo|
  2 / 2 FILE_CRCERR: file DID NOT match official crc (displayed with red background in anidb)
  3 / 4 FILE_ISV2: file is version 2
  4 / 8 FILE_ISV3: file is version 3
  5 / 16 FILE_ISV4: file is version 4
  6 / 32 FILE_ISV5: file is version 5


:* examples:
> FILE aname=narutaru&gname=triad&amp;aone&epno=2&s=xxxxx
  state ==== 9 ==> FILE_CRCOK+FILE_ISV3 ==> file matched official crc and is version 3
< t001 220 FILE
  state ==== 0 ==> - ==> file was not crc checked and is version 1
15459|782|8772|380|1|171298816|2c8a3b53d94d8579b9b81941c549e108|Narutaru - 02 - Catastrophe During the Daytime - [Triad & AonE].avi
  state ==== 34 ==> FILE_CRCERR+FILE_ISV5 ==> file DID NOT match official crc and is version 5
</pre>
  state ==== 1 ==> FILE_CRCOK ==> file matched official crc and is version 1
  state ==== 8 ==> FILE_ISV3 ==> file was not crc checked and is version 3


----
== Mylist Commands ==
=== MYLIST: Retrieve Mylist Data ===
=== MYLIST: Retrieve Mylist Data ===
'''Command String:'''
'''Command String:'''
:by lid: (mylist id)  
by lid: (mylist id)
:* MYLIST lid={int4 lid}  
* MYLIST lid={int4 lid}
:by fid:  
by fid:
:* MYLIST fid={int4 fid}  
* MYLIST fid={int4 fid}
:by size+ed2k hash:  
by size+ed2k hash:
:* MYLIST size={int4 size}&ed2k={str ed2khash}  
* MYLIST size={int4 size}&ed2k={str ed2khash}
by anime + group + epno
* MYLIST aname={str anime name}&gname={str group name}&epno={int4 episode number}
* MYLIST aname={str anime name}&gid={int4 group id}&epno={int4 episode number}
* MYLIST aid={int4 anime id}&gname={str group name}&epno={int4 episode number}
* MYLIST aid={int4 anime id}&gid={int4 group id}&epno={int4 episode number}


'''Possible Replies:'''
'''Possible Replies:'''
:* 221 MYLIST
* 221 MYLIST
:: {int4 lid}|{int4 fid}|{int4 eid}|{int4 aid}|{int4 gid}|{int4 date}|{int2 state}|{int4 viewdate}|{str storage}|{str source}|{str other}
: {int4 lid}|{int4 fid}|{int4 eid}|{int4 aid}|{int4 gid}|{int4 date}|{int2 state}|{int4 viewdate}|{str storage}|{str source}|{str other}
* 322 MULTIPLE FILES FOUND
: {str anime title}|{int episodes}|{str eps with state unknown}|{str eps with state on hhd}|{str eps with state on cd}|{str eps with state deleted}|{str watched eps}|{str group 1 short name}|{str eps for group 1}|...|{str group N short name}|{str eps for group N}
* 321 NO SUCH ENTRY


:* 321 NO SUCH ENTRY
'''Info:'''
* The state field provides information about the location and sharing state of a file in mylist.
* If files are added after hashing, a client should specify the state as 1 (on hdd) (if the user doesn't explicitly select something else).
* eps is a list of episodes, e.g. "1-12,14-16,T1"


'''Info:'''
'''States:'''
:* The state field provides information about the location and sharing state of a file in mylist.
:* If files are added after hashing, a client should specify the state as 1 (on hdd) (if the user doesn't explicitly select something else).
:* states:
   0 - unknown - state is unknown or the user doesn't want to provide this information
   0 - unknown - state is unknown or the user doesn't want to provide this information
   1 - on hdd - the file is stored on hdd (but is not shared)
   1 - on hdd - the file is stored on hdd (but is not shared)
   2 - on cd - the file is stored on cd
   2 - on cd - the file is stored on cd
   3 - deleted - the file has been deleted or is not available for other reasons (i.e. reencoded)
   3 - deleted - the file has been deleted or is not available for other reasons (i.e. reencoded)
  4 - shared - the file is stored on hdd and shared
  5 - release - the file is stored on hdd and shared on release priority


'''Example:'''
  > MYLIST aname=gits sac&s=xxxxx
  <322 MULTIPLE FILES FOUND
  |1-26,S2-S27|1-26|||V-A|S2-S27|LMF|20-26|KAA|1-12,21-23|anime_fin|1-26|AonE|1-19|Anime-MX|1-3,17-20


== Data Storage ==
----
=== MYLIST ADD: Add file to mylist ===
=== MYLISTADD: Add file to mylist ===
'''Command String:'''
'''Command String:'''
:by lid: (mylist id, edit only)  
by lid: (mylist id, edit only)
:* MYLISTADD lid={int4 lid}&edit=1[&state={int2 state}&viewed={boolean viewed}&source={str source}&storage={str storage}&other={str other}]  
* MYLISTADD lid={int4 lid}&edit=1[&state={int2 state}&viewed={boolean viewed}&source={str source}&storage={str storage}&other={str other}]
:by fid:  
by fid:
:* MYLISTADD fid={int4 fid}[&state={int2 state}&viewed={boolean viewed}&source={str source}&storage={str storage}&other={str other}][&edit=1]  
* MYLISTADD fid={int4 fid}[&state={int2 state}&viewed={boolean viewed}&source={str source}&storage={str storage}&other={str other}][&edit=1]
:by size+ed2k hash:  
by size+ed2k hash:
:* MYLISTADD size={int4 size}&ed2k={str ed2khash}[&state={int2 state}&viewed={boolean viewed}&source={str source}&storage={str storage}&other={str other}][&edit=1]  
* MYLISTADD size={int4 size}&ed2k={str ed2khash}[&state={int2 state}&viewed={boolean viewed}&source={str source}&storage={str storage}&other={str other}][&edit=1]
by anime + group + epno
* MYLISTADD aname={str anime name}[&gname={str group name}&epno={int4 episode number}][&state={int2 state}&viewed={boolean viewed}&source={str source}&storage={str storage}&other={str other}][&edit=1]
* MYLISTADD aname={str anime name}[&gid={int4 group id}&epno={int4 episode number}][...]
* MYLISTADD aid={int4 anime id}[&gname={str group name}&epno={int4 episode number}][...]
* MYLISTADD aid={int4 anime id}[&gid={int4 group id}&epno={int4 episode number}][...]


'''Possible Replies:'''
'''Possible Replies:'''
:* 210 MYLIST ENTRY ADDED  
* 320 NO SUCH FILE
:* 310 FILE ALREADY IN MYLIST  
* 330 NO SUCH ANIME
:* 311 MYLIST ENTRY EDITED  
* 350 NO SUCH GROUP
:* 410 NO SUCH FILE
when edit=0
:* 411 NO SUCH MYLIST ENTRY  
* 210 MYLIST ENTRY ADDED
:* 505 ILLEGAL INPUT OR ACCESS DENIED
: {int4 number of entries added}
* 310 FILE ALREADY IN MYLIST
* 322 MULTIPLE FILES FOUND
: {int4 fid 1}|{int4 group name 1}
: ...
: {int4 fid n}|{int4 group name n}
when edit=1
* 311 MYLIST ENTRY EDITED
* 311 MYLIST ENTRY EDITED
: {int4 number of entries edited}
* 411 NO SUCH MYLIST ENTRY


'''Info:'''
'''Info:'''
:* All data except lid/fid/size+hash is optional.
* All data except lid/fid/size+hash is optional.
:* Viewed should be 0 for unwatched files and 1 for watched files.
* Viewed should be 0 for unwatched files and 1 for watched files.
:* Other is the only field which may contrain newlines, but they have to be stored as <br>
* Other is the only field which may contrain newlines, but they have to be stored as <br>
:* If edit is 1 then an existing entry, if found, will be updated with the given values.
* If edit is 1 then an existing entry, if found, will be updated with the given values.
:* For state values refer to: '''MYLIST'''
* For state values refer to: '''MYLIST'''
:* If you want to change an existing entry and already know it's mylist id (lid) please use the lid-version of this command. It put less load on the server.
* If you want to change an existing entry and already know it's mylist id (lid) please use the lid-version of this command. It put less load on the server.
* epno=0 means all eps (default), negative numbers means upto. (-12 -> upto 12)
* group is optional only when edit=1, meaning you can't add every file for an anime
{{eyecatch|NOTE:| Currently this command does not update the internal caches of AniDB. Using this command will lead to wrong stats values/counts being displayed in your Mylist & co @ AniDB for upto 24h.}}
{{eyecatch|NOTE:| Currently this command does not update the internal caches of AniDB. Using this command will lead to wrong stats values/counts being displayed in your Mylist & co @ AniDB for upto 24h.}}
{{eyecatch|NOTE:| Currently this command will replace all mylist fields this commands supports, even if they were not specified by the client. I.e. an update with <nowiki>"MYLISTADD lid={int4 lid}&edit=1&viewed=1"</nowiki> will reset the state,source,storage and other fields to their default values.}}
{{eyecatch|NOTE:| Currently this command will replace all mylist fields this commands supports, even if they were not specified by the client. I.e. an update with <nowiki>"MYLISTADD lid={int4 lid}&edit=1&viewed=1"</nowiki> will reset the state,source,storage and other fields to their default values.}}
Line 495: Line 707:


----
----
=== MYLISTDEL: Remove file from mylist ===
'''Command String:'''
by lid: (mylist id)
* MYLISTDEL lid={int4 lid}
by fid:
* MYLISTDEL fid={int4 fid}
by anime + group + epno
* MYLISTDEL aname={str anime name}[&gname={str group name}&epno={int4 episode number}]
* MYLISTDEL aname={str anime name}[&gid={int4 group id}&epno={int4 episode number}]
* MYLISTDEL aid={int4 anime id}[&gname={str group name}&epno={int4 episode number}]
* MYLISTDEL aid={int4 anime id}[&gid={int4 group id}&epno={int4 episode number}]
'''Possible Replies:'''
* 211 ENTRY DELETED
: {int4 number of entries}
* 411 NO SUCH ENTRY


=== MYLIST DEL: Remove file from mylist ===
'''Info:'''
* Currently this command does not update the internal caches of AniDB. Using this command will lead to wrong stats values/counts being displayed in your Mylist & co @ AniDB for upto 24h.
* epno=0 means all eps (default), negative numbers means upto. (-12 -> upto 12)
* group is optional
* command will delete all enties found
 
----
=== MYLISTSTATS : Retrieve mylist stats ===
'''Command String:'''
'''Command String:'''
: by lid: (mylist id)
* MYLISTSTATS
:* MYLISTDEL lid={int4 lid}  
'''Possible Replies:'''
: by fid:
* 222 MYLIST STATS
:* MYLISTDEL fid={int4 fid}  
{animes}|{eps}|{files}|{size of files}|{added animes}|{added eps}|{added files}|{added groups}|{leech %}|{lame %}|{viewed % of db}|{mylist % of db}|{viewed % of mylist}|{number of viewed eps}|{votes}|{reviews}
 
'''Info:'''
* All fields are int
 
----
=== VOTE: Vote for a specifed anime, episode or group ===
'''Command String:'''<br>
by id
* VOTE type={int2 type}&id={int4 id}[&value={int4 vote value}&epno={int4 episode number}]
by name
* VOTE type={int2 type}&name={string name}[&value={int4 vote value}&epno={int4 episode number}]


'''Possible Replies:'''
'''Possible Replies:'''
:* 211 ENTRY DELETED
* 260 VOTED
:* 411 NO SUCH ENTRY
: {str aname/ename/gname}
:* 505 ILLEGAL INPUT OR ACCESS DENIED
* 261 VOTE FOUND
: {str aname/ename/gname}|{vote value}
* 262 VOTE UPDATED
: {str aname/ename/gname}|{old vote value}
* 263 VOTE REVOKED
: {str aname/ename/gname}|{revoked vote value}
* 360 NO SUCH VOTE
* 361 INVALID VOTE TYPE
* 362 INVALID VOTE VALUE
* 363 PERMVOTE NOT ALLOWED
: {str aname}
* 364 ALREADY PERMVOTED
: {str aname/ename/gname}


'''Info:'''
'''Info:'''
:* Currently this command does not update the internal caches of AniDB. Using this command will lead to wrong stats values/counts being displayed in your Mylist & co @ AniDB for upto 24h.
* type: 1=anime, 2=anime tmpvote, 3=group
* for episode voting add epno on type=1
* value: negative number means revoke, 0 means retrieve (default), 100-1000 are valid vote values, rest is illegal
* votes will be updated automatically (no questions asked)
* tmpvoting when there exist a perm vote is not possible
 
----
=== RANDOM: Get a random anime ===
'''Command String:'''
* RANDOMANIME type={int4 type}
 
'''Possible Replies:'''
* 230 ANIME ... (see ANIME)
 
'''Info:'''
* type: 0=from db, 1=watched, 2=unwatched, 3=all mylist


== Misc Commands ==
== Misc Commands ==
=== PING: Ping Command ===
=== PING: Ping Command ===
'''Command String:'''
'''Command String:'''
:* PING
* PING
 
'''Possible Replies:'''
* 300 PONG
 
'''Info:'''
* May be used by a frontend to determin if the API is sill available.
* May be executed even if not yet logged in.
 
----
=== UPTIME ===
'''Command String:'''
* UPTIME


'''Possible Replies:'''
'''Possible Replies:'''
:* 300 PONG
* 208 UPTIME
: {int4 udpserver uptime in sec}
 
----
=== STATS ===
'''Command String:'''
* STATS
 
'''Possible Replies:'''
* 206 STATS
: {int4 animes)|{int4 eps}|{int4 files}|{int4 groups}|{int4 users}|{int4 creqs}
 
----
=== TOP ===
'''Command String:'''
* TOP
 
'''Possible Replies:'''
* 207 TOP
: {str longest mylist}|{int count}
: {str largest mylist}|{int count}
: {str most lame files}|{int count}
: {str most indep. user}|{int count}
: {str biggest leecher}|{int count}
: {str most anime added}|{int count}
: {str most eps added}|{int count}
: {str most files added}|{int count}
: {str most groups added}|{int count}
: {str most votes}|{int count}
: {str most reviews}|{int count}


'''Info:'''
'''Info:'''
:* May be used by a frontend to determin if the API is sill available.
* 'Hide myself in IRC stats' applies for this too.
:* May be executed even if not yet logged in.
 
----
=== SENDMSG: Send Message ===
'''Command String:'''
* SENDMSG to={str username}&title={str title}&body={str body}


'''Possible Replies:'''
* 294 SENDMSG SUCCESSFUL
* 394 NO SUCH USER
* 501 LOGIN FIRST
'''Note:'''
* This command only works if you are logged in.
* This command allows you to send an AniDB message.
{{eyecatch|IMPORTANT:|
title must not be longer than 100 chars.
body must not be longer than 1200 chars.
}}


== Fatal Errors ==
== Fatal Errors ==
At anypoint int the retrieval process you have to expect the following output:  
At anypoint int the retrieval process you have to expect the following output:
:* 6xx INTERNAL SERVER ERROR
* 6xx INTERNAL SERVER ERROR
:: ERROR: {str errormessage}  
: ERROR: {str errormessage}
:OR  
OR
:*6xx INTERNAL SERVER ERROR - {str errormessage}  
*6xx INTERNAL SERVER ERROR - {str errormessage}


Such errors should be reported back to [[User:Exp|Exp]].
Such errors should be reported back to [[User:Epoximator|Epoximator]].
(xx is a number between 00 and 99)
(xx is a number between 00 and 99)


If you supply an unknown or unimplemented command you will get an error:
If you supply an unknown or unimplemented command you will get an error:
:* 598 UNKNOWN COMMAND
* 598 UNKNOWN COMMAND
 
== RETURN CODES ==
<pre>
/*
* POSITVE 2XX
*/
LOGIN_ACCEPTED =200, //C
LOGIN_ACCEPTED_NEW_VER =201, //C
LOGGED_OUT =203, //C
STATS =206, //N
TOP =207, //N
UPTIME =208, //N
 
MYLIST_ENTRY_ADDED =210, //C
ENTRY_DELETED =211, //C
 
FILE =220, //C
MYLIST =221, //C
MYLIST_STATS =222, //N
 
ANIME =230, //N
ANIME_BEST_MATCH =231, //N
RANDOMANIME =232, //N
 
EPISODE =240, //N
GROUP =250, //N
 
VOTED =260, //N
VOTE_FOUND =261, //N
VOTE_UPDATED =262, //N
VOTE_REVOKED =263, //N
 
NOTIFICATION_ENABLED =270, //C
PUSHACK_CONFIRMED =280, //C
NOTIFYACK_SUCCESSFUL_M =281, //C
NOTIFYACK_SUCCESSFUL_N =282, //C
NOTIFICATION =290, //C
NOTIFYLIST =291, //C
NOTIFYGET_MESSAGE =292, //C
NOTIFYGET_NOTIFY =293, //C
SENDMSG_SUCCESSFUL =294, //C
 
/*
* AFFIRMATIVE/NEGATIVE 3XX
*/
PONG =300, //C
FILE_ALREADY_IN_MYLIST =310, //C
MYLIST_ENTRY_EDITED =311, //C
NO_SUCH_FILE =320, //C
NO_SUCH_ENTRY =321, //C
MULTIPLE_FILES_FOUND =322, //N
 
NO_SUCH_ANIME =330, //N
NO_SUCH_EPISODE =340, //N
NO_SUCH_GROUP =350, //N
 
NO_SUCH_VOTE =360, //N
INVALID_VOTE_TYPE =361, //N
INVALID_VOTE_VALUE =362, //N
PERMVOTE_NOT_ALLOWED =363, //N
ALREADY_PERMVOTED =364, //N
 
NOTIFICATION_DISABLED =370, //C
NO_SUCH_PACKET_PENDING =380, //C
NO_SUCH_ENTRY_M =381, //C
NO_SUCH_ENTRY_N =382, //C
 
NO_SUCH_MESSAGE =392, //C
NO_SUCH_NOTIFY =393, //C
NO_SUCH_USER =394, //C
 
NO_SUCH_DATA_ENTRY =396, //N
 
/*
* NEGATIVE 4XX
*/
 
NOT_LOGGED_IN =403, //C
NO_SUCH_MYLIST_FILE =410, //C
NO_SUCH_MYLIST_ENTRY =411, //C
 
 
/*
* CLIENT SIDE FAILURE 5XX
*/
 
LOGIN_FAILED =500, //C
LOGIN_FIRST =501, //C
ACCESS_DENIED =502, //C
CLIENT_VERSION_OUTDATED =503, //C
CLIENT_BANNED =504, //C
ILLEGAL_INPUT_OR_ACCESS_DENIED =505, //C
INVALID_SESSION =506, //C
BANNED_FOR_FLOODING =507, //C
UNKNOWN_COMMAND =598, //C
 
/*
* SERVER SIDE FAILURE 6XX
*/
 
INTERNAL_SERVER_ERROR =600, //C
ANIDB_OUT_OF_SERVICE =601, //C
API_VIOLATION =666, //C
</pre>


[[Category: Development]]
[[Category: Development]]
546

edits

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