Character
Version 16 (nimetu, 12/18/2013 01:47 pm)
1 | 1 | vl | h1. Character |
---|---|---|---|
2 | 1 | vl | |
3 | 16 | nimetu | Access character information. |
4 | 1 | vl | |
5 | 1 | vl | h2. Base URL |
6 | 1 | vl | |
7 | 16 | nimetu | * http://api.ryzom.com/api/character.php?apikey=key |
8 | 16 | nimetu | * http://api.ryzom.com/api/character.php?apikey[]=key1&apikey[]=key2 |
9 | 1 | vl | |
10 | 11 | vl | h2. URL Parameters |
11 | 1 | vl | |
12 | 16 | nimetu | h3. @apikey@ |
13 | 1 | vl | |
14 | 16 | nimetu | Character [[API key]]. |
15 | 1 | vl | |
16 | 1 | vl | h2. Cache Duration |
17 | 1 | vl | |
18 | 16 | nimetu | *<character>* xml element has attributes *created* and *cached_until* (utc timestamp) |
19 | 1 | vl | |
20 | 1 | vl | h2. PHP Interface |
21 | 1 | vl | |
22 | 16 | nimetu | h3. @ryzom_character_api($apikey)@ |
23 | 11 | vl | |
24 | 16 | nimetu | @$apikey@ can be either string (single key) or array of strings. |
25 | 10 | vl | |
26 | 16 | nimetu | On success, function returns associative array of *SimpleXMLElement* with @$apikey@ as array index. |
27 | 16 | nimetu | On failure, function returns boolean *false*. |
28 | 11 | vl | |
29 | 16 | nimetu | h2. XML structure |
30 | 11 | vl | |
31 | 16 | nimetu | API is able to return information about multiple characters at once and so each *<character>* element is child of *<ryzomapi>* root element |
32 | 16 | nimetu | @<ryzomapi> |
33 | 16 | nimetu | <character apikey="key1" created="1387369332" modules="C01:P01" cached_until="1387369632"> |
34 | 16 | nimetu | .... |
35 | 16 | nimetu | </character> |
36 | 16 | nimetu | <character apikey="key2" created="1387369332" modules="P01" cached_until="1387369632"> |
37 | 16 | nimetu | .... |
38 | 16 | nimetu | </character> |
39 | 16 | nimetu | </ryzomapi>@ |
40 | 11 | vl | |
41 | 16 | nimetu | h3. Invalid key error |
42 | 11 | vl | |
43 | 16 | nimetu | When provided key is invalid, then xml contains *<error>* element with *code* attribute. |
44 | 16 | nimetu | @<character apikey="key1" created="1387369873"> |
45 | 16 | nimetu | <error code="404">invalid key</error> |
46 | 16 | nimetu | </character>@ |
47 | 1 | vl | |
48 | 16 | nimetu | Possible error codes are listed on [[API error codes]]. |