Access character information.
<base URL>/character.php?apikey=key <base URL> /character.php?apikey[=key1&apikey[]=key2
<character> xml element has attributes *created* and *cached_until* (utc timestamp)
API is able to return information about multiple characters at once and so each <character> element is child of <ryzomapi> root element:
<ryzomapi>
<character apikey="key1" created="1387369332" modules="C01:P01" cached_until="1387369632">
....
</character>
<character apikey="key2" created="1387369332" modules="P01" cached_until="1387369632">
....
</character>
</ryzomapi>
Invalid key error:
<character apikey="key1" created="1387369873">
<error code="404">invalid key</error>
</character>
Possible error codes are listed on API error codes.
ryzom_character_api($apikey)
<?php require_once "ryzomapi_lite.php";
function info($char) {
if (isset($char->error)) {
$apikey = htmlspecialchars($char['apikey']);
$error = htmlspecialchars($char->error);
$code = (int)$char->error['code'];
echo "Character API key '{$apikey}' failed: {$code}:{$error}";
} else {
$name = htmlspecialchars($char->name);
echo "Character name: {$name}";
}
}:
$apikey = 'cABCDEF';
$chars = ryzom_character_api($apikey);
if ($chars !== false) {
info($chars[$apikey]);
} else {
echo "Character API failed";
}
$apikeys = ['cABCDEF', 'c123456'];
$chars = ryzom_character_api($apikeys);
if ($chars !== false) {
foreach($chars as $char) {
info($char);
}
} else {
echo "Character API failed";
}