UDP API DEV: Difference between revisions
Line 21: | Line 21: | ||
'''Replies:''' | '''Replies:''' | ||
* This command should return all missing informations from ANIME, sush as companies, external links (ANN, ...), awards, ... | * This command should return all missing informations from ANIME, sush as companies, external links (ANN, ...), awards, ... | ||
--[[User:Darsh|Darsh]] 12:10, 19 April 2006 (CEST) | |||
=== [[UDP_API_Definition#EPISODE:_Retrieves_data_for_a_specific_episode|EPISODE]] === | === [[UDP_API_Definition#EPISODE:_Retrieves_data_for_a_specific_episode|EPISODE]] === |
Revision as of 10:13, 19 April 2006
UDP API DEVELOPMENT
- add feature requests here
- feel free to edit / comment / whatever
Data Commands
ANIME
Possible Replies:
- XXX ANIME BEST MATCH
- ...
Comments:
I'd like this command to cope with a couple of different encodings when passed a title, and be explicit over whether it finds only one result or does a best-match guess. --Rar 04:51, 30 Oct 2005 (CET)
- On second thought, is a wide search really wanted or is 'WHERE lower(name)=' good enough?. About encodings, do you care to elaborate? --Epoximator 18:24, 25 November 2005 (CET)
- Oh, specifically, I'd like anime lookups to be able to take sjis/utf8 rather than just html escaped ascii, as an option. While all real programming languages have trivial encoding switching:
string.decode('sjis').encode('ascii','xmlcharrefreplace')
some that might find a use for udp access to anidb (such as the dire mirc scripting language), do not, so dealing with it serverside would be nice. --Rar 01:28, 29 January 2006 (CET)
- Oh, specifically, I'd like anime lookups to be able to take sjis/utf8 rather than just html escaped ascii, as an option. While all real programming languages have trivial encoding switching:
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)
EPISODE
GROUP
FILE
Comments:
Pass a list of fields (limit e.g. 10 entries)
and return content. This makes it possible to request new fields in the database without
breaking API for older clients.
On updates, only the list of possible fields
need to be extendet. -- --Dinoex
- I think it's a good idea. Modified a bit. --Epoximator 13:38, 26 November 2005 (CET)
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)
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
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.
Command String:
- ENCODING name={str encoding name}
Possible Replies:
- XXX ENCODING ENABLED
- XXX ENCODING NOT SUPPORTED
Info:
- Supported encodings: http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html
- Default: ASCII.
Comments:
- This could be included in the AUTH command or an environment command that includes options for encryption, encoding and compression. (In response to rar's request.) --Epoximator 11:48, 31 January 2006 (CET)
- This should definetly become an additional, optional parameter of the AUTH command. There is really no reason why this should be an extra command. It just means two more UDP packets overhead on each client connection. --Exp 05:28, 8 February 2006 (CET)
- I think epoxi was more thinking of this command as setting a session state flag, like a parameter in AUTH would, rather than being sent prior to *every* command, which would of course be silly. I see no reason not to have both. --Rar 16:21, 10 February 2006 (CET)
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/max values?