UDP API DEV

From AniDB
Jump to navigation Jump to search

UDP API DEVELOPMENT

  • add feature requests here
  • feel free to edit / comment / whatever

Data Commands

ANIME

Command String:
by aid

  • ANIME aid={int4 id}[&acode={int4}]

by name

  • ANIME aname={str anime name}[&acode={int4}]

acode:

Bit Decimal Data field - Bit Decimal Data field
0 1 int4 aid 16 65536 str url
1 2 int4 episodes 17 131072 str picname
2 4 int4 normal ep count 18 262144 str year
3 8 int4 special ep count 19 524288 str type
4 16 int4 rating 20 1048576 str romaji name
5 32 int4 vote count 21 2097152 str kanji name
6 64 int4 temp rating 22 4194304 str english name
7 128 int4 temp vote count 23 8388608 str other name
8 256 int4 average review rating 24 16777216 str short name list
9 512 int4 review count 25 33554432 str synonym list
10 1024 int4 air date 26 67108864 str category list
11 2048 int4 end date 27 134217728 str related aid list
12 4096 int4 anime planet id 28 268435456 str producer name list
13 8192 int4 anime news network id 29 536870912 str producer id list
14 16384 int4 allcinema id 30 1073741824 str award list
15 32768 str animenfo id 31 -2147483648 reserved (all)

ANIMEINFO

Syntax:

  • ANIMEINFO aid={int4 id} | aname={str animename}

Replies:

  • This command should return all missing informations from ANIME, sush as companies, external links (ANN, ...), awards, ...--Darsh 12:10, 19 April 2006 (CEST)
OK. But included in ANIME with an argument, like acode.--Epoximator 00:18, 21 April 2006 (CEST)
Thanks, but what about awards? Moreover I'm not sure that having few commands that returns a lot of data is the best solution. --Darsh 22:50, 01 May 2006 (CEST)
Added awards. Not sure what you mean... You only request what you need by setting the corresponding bits in acode. --Epoximator 11:02, 2 May 2006 (CEST)

EPISODE

GROUP

FILE

Possible return codes:

  • XXX MULTIPLE FILES FOUND
fid|state

Comments:
Selection by anime, group and episode number is not unique. As an example: FILE aid=22&gid=41&tag=tag0002&epno=1
This commands always return only the first match. --Darsh 12:10, 19 April 2006 (CEST)

Can be fixed with MULTIPLE FILES FOUND, or just return the latest version. Maybe selectable with an argument.--Epoximator 00:18, 21 April 2006 (CEST)

Add {str anidbfilename} to fcode? --Darsh 10:56, 25 April 2006 (CEST)

ok. bit 30 @ fcode --Epoximator 21:34, 28 April 2006 (CEST)

PRODUCER

Command String:
by id

  • PRODUCER pid={int4 producer id}

by name

  • PRODUCER pname={str producer name/short name/other name}

Possible Replies:

  • XXX PRODUCER
{int4 id}|{str name}|{str short name}|{str other name}|{str type}|{str picture name}|{str home page url}

Example:

 > PRODUCER pid=1
 < 245 PRODUCER
 1|GAINAX||ガイナックス|Company|1088.gif|http://www.gainax.co.jp/

Buddy Commands

Group of commands used to administrate your buddylist.

BUDDYADD

Command String:

  • ADDBUDDY uid={int4 buddy uid}
  • ADDBUDDY uname={int4 buddy name}

Possible Replies:

  • XXX BUDDY ADDED
  • XXX NO SUCH USER
  • XXX USER IS ALREADY A BUDDY

BUDDYDEL

Command String:

  • DELBUDDY uid={int4 buddy uid}

Possible Replies:

  • XXX BUDDY DELETED
  • XXX NO SUCH BUDDY
  • XXX YOU GOT NO FRIENDS

BUDDYACCEPT

Command String:

  • ACCEPTBUDDY uid=NNN

Possible Replies:

  • XXX BUDDY ACCEPTED
  • XXX NO SUCH BUDDY
  • XXX BUDDY ALREADY ACCEPTED

BUDDYDENY

Command String:

  • DENYBUDDY uid={int4 buddy uid}

Possible Replies:

  • XXX BUDDY DENIED
  • XXX NO SUCH USER
  • XXX BUDDY ALREADY DENIED

BUDDYLIST

Command String:

  • BUDDYLIST startat={int2 start at #}

Possible Replies:

  • NNN {int2 start} {int2 end} {int2 total} BUDDY LIST
{int4 uid}|{str username}|{int2 state}
...

Info:

  • state is a 16bit bit field in integer notation (lowest bit first):
 * bit 1 = this user is in your buddylist
 * bit 2 = this user has accepted you
 * bit 3 = this user is waiting for your approval

BUDDYSTATE

Command String:

  • BUDDYSTATE startat={int2 start at #}

Possible Replies:

  • XXX {int2 start} {int2 end} {int2 total} BUDDY STATE
{int4 uid}|{int2 onlinestate}
...

Info:

  • onlinestate is a 16bit bit field in integer notation (lowest bit first):
  * bit 1 = http online (user has issued a HTTP request within the last 10 minutes)
  * bit 2 = udp api online (user is currently connected to the udp api server)
  * example: 0=offline, 1=http online, 2=udp api online, 3=http&udp api online

NOTIFY : extend

Command String:

  • NOTIFY [buddy=1]

Notification Packet Format:

  • Extension of notification:
 290 NOTIFICATION
 {int4 pending_notifies}|{int4 pending_msgs}|{int4 number_of_online_buddys}

That way if we requested a notify command and number_of_online_buddys was more than 0 we could then do a BUDDYLIST to get the status of the users.

PUSH : extend

Command String:

  • PUSH notify={bool push_file_added_notifications}&msg={bool push_msg_added_notifications}[&buddy={bool push_buddy_event_notifications}]

Notification Packet Format:

  • Buddy Event Notify:
 273 {int4 notify_packet_id} NOTIFICATION
 {int4 buddy uid}|{int2 event type}
  • Possible event types:
 0 => LOGIN
 1 => LOGOUT
 2 => ACCEPTED
 3 => ADD (?)

Misc Commands

ENCRYPT

Will cause all future messages from the server, except the first (the reply to the ENCRYPT command itself), to be encrypted (128 bit AES). The client will also have to encrypt all future requests sent to the server. All non-encrypted messages will be discarded by the server. The encryption key is the MD5 hash of a special (new/to be added) password defined in the users profile concatenated with the salt string as given in the reply to the ENCRYPT message. A normal AUTH message is still necessary to authenticate and should follow the ENCRYPT command once the API has acknowledged the encryption.

Command String:

  • ENCRYPT user={str name}[&type={int2 type}]

Possible Replies:

  • XXX {str salt} ENCRYPTION ENABLED
  • XXX NO SUCH USER
  • XXX ENCRYPTION PASSWORD NOT DEFINED
  • XXX NO SUCH TYPE

Info:

  • user is username
  • type is type of encryption, 1 => 128 bit AES, none other defined atm
  • encryption pass must be set in profile settings on the website
  • it is not possible to disable the encryption once enabled while staying logged in
  • a logout (the logout message needs to be correctly encrypted) or timeout will disable the encryption
  • in order to minimize server load, encryption should be disabled by default and should have to be enabled manually by the user in the configuration options.
  • the encryption key is md5(special_api_password_of_user+salt)


ENCODING

Sets preferred encoding per session.

Command String:

  • ENCODING name={str encoding name}

Possible Replies:

  • XXX ENCODING ENABLED
  • XXX ENCODING NOT SUPPORTED

Info:

AUTH : extend

Command String:

  • AUTH user={str username}&pass={str password}&protover={int4 apiversion}&client={str clientname}&clientver={int4 clientversion}[&nat=1&comp=1&enc={str encoding}&mtu{int4 mtu value}]

Info:

  • enc=x will change the encoding used. Supported encodings are these. The encoding will change right away (including the response), if it is supported, and be reset on logout/timeout.
  • comp=1 means that the client supports compression (DEFLATE). The server will compress (instead of truncating) the datagrams when needed if this option is enabled. The first two bytes of compressed datagrams will always be set to zero. (So tags should never start with that.)
  • Default mtu is 1400. Min = 400, Max = 1400.

API Status Notification

GOINGDOWN

Clients with any notification on will receive the GOINGDOWN message before the API goes offline.

Notification Packet Format:

 XXX {int4 notify_packet_id} NOTIFICATION
 {int4 time offline}|{int4 comment}

Info:

  • Time offline is the time in minutes the API will be down, 0 if indefinite (client can direct user to the anidb site for status updates).
  • The comment is a short explanation for the downtime.
  • Only one datagram will be sent, and the server will not listen for replies.

Comment:

Time offline and comment will most likely not be specified normally. '0|None' will be the default and should indicate restart for update. --Epoximator 20:52, 28 April 2006 (CEST)