(→Third party libraries: Portal) |
|||
Line 10: | Line 10: | ||
In our case: [[Ryzom API]] is an URL based system to get some Ryzom ''in-game information'' like game time, character, guild profile... | In our case: [[Ryzom API]] is an URL based system to get some Ryzom ''in-game information'' like game time, character, guild profile... | ||
− | API changes log can be found on '''<span class="plainlinks">[https://app.ryzom.com/app_forum/index.php?page=topic/view/18541 forum]</span>''' | + | API changes log can be found on '''<span class="plainlinks">[https://app.ryzom.com/app_forum/index.php?page=topic/view/18541 forum]</span>'''. |
=Basics= | =Basics= | ||
Line 27: | Line 27: | ||
([[:wikipedia:PHP|PHP]]) Sheet translations and info about resources can be found from the <span class="plainlinks">[https://github.com/nimetu/ryzom-extra https://github.com/nimetu/ryzom_extra]</span> repository. The <span class="plainlinks">[https://github.com/nimetu/ryzom_extra/tree/json-resources json-resources]</span> branch has data in [[:wikipedia:JSON|JSON]] format. | ([[:wikipedia:PHP|PHP]]) Sheet translations and info about resources can be found from the <span class="plainlinks">[https://github.com/nimetu/ryzom-extra https://github.com/nimetu/ryzom_extra]</span> repository. The <span class="plainlinks">[https://github.com/nimetu/ryzom_extra/tree/json-resources json-resources]</span> branch has data in [[:wikipedia:JSON|JSON]] format. | ||
+ | =Functions= | ||
+ | ==Time== | ||
+ | To know the time and date in Ryzom. | ||
+ | ===Usage=== | ||
+ | <base URL>/time.php | ||
+ | |||
+ | ===URL Parameters=== | ||
+ | |||
+ | ====format==== | ||
+ | (optional), defaults ro raw. | ||
+ | :*<code>raw</code> : Returns the tick. The server tick is a 32 bit integer that increases by one every 100 milliseconds. | ||
+ | :*<code>txt</code> : Returns a homine-readable string. | ||
+ | :*<code>xml</code> : Returns an xml file that contains all shard time information. | ||
+ | |||
+ | ===Cache duration=== | ||
+ | The data is cached for 1 minute. | ||
+ | |||
+ | ===PHP interface=== | ||
+ | ryzom_time_api() | ||
+ | |||
+ | Returns SimpleXMLElement or boolean false on failure. | ||
+ | === XML structure === | ||
+ | |||
+ | :<syntaxhighlight lang="xml"><shard_time> | ||
+ | <server_tick>514105152</server_tick> | ||
+ | <jena_year>2576</jena_year> | ||
+ | <day_of_jy>319</day_of_jy> | ||
+ | <month_of_jy>10</month_of_jy> | ||
+ | <cycle>0</cycle> | ||
+ | <day_of_cycle>319</day_of_cycle> | ||
+ | <month_of_cycle>10</month_of_cycle> | ||
+ | <day_of_month>19</day_of_month> | ||
+ | <day_of_week>1</day_of_week> | ||
+ | <season>3</season> | ||
+ | <day_of_season>49</day_of_season> | ||
+ | <time_of_day>13</time_of_day> | ||
+ | <txt_en>13h - Dua, Mystia 20, 1st AC 2576</txt_en> | ||
+ | <txt_fr>13h - Dua, Mystia 20, 1er CA 2576</txt_fr> | ||
+ | <txt_de>13h - Dua, Mystia 20, 1. AZ 2576</txt_de> | ||
+ | <cache created="1387437183" expire="1387437243"/> | ||
+ | </shard_time></syntaxhighlight> | ||
+ | |||
+ | |||
+ | :<syntaxhighlight lang="php"><?php | ||
+ | require_once "ryzomapi_lite.php"; | ||
+ | |||
+ | $time = ryzom_time_api('xml'); | ||
+ | if ($time !== false) { | ||
+ | $txt_en = htmlspecialchars($time->txt_en); | ||
+ | echo "Atys time is {$txt_en}"; | ||
+ | } else { | ||
+ | echo "API failure"; | ||
+ | }</syntaxhighlight> | ||
+ | |||
<br /> | <br /> | ||
<br /> | <br /> |
This page is the Wiki Forge version of api.ryzom.com site
According to Wikipedia, an An API or "Application Programming interface" is a computing interface which defines interactions between multiple software intermediaries. It defines the kinds of calls or requests that can be made, how to make them, the data formats that should be used, the conventions to follow, etc. [...]Through information hiding, APIs enable modular programming, which allows users to use the interface independently of the implementation.
In our case: Ryzom API is an URL based system to get some Ryzom in-game information like game time, character, guild profile... API changes log can be found on forum.
All requests are using https://api.ryzom.com as base url.
PHP API library can be found in the ryzomapi_lite repository.
(PHP) Sheet translations and info about resources can be found from the https://github.com/nimetu/ryzom_extra repository. The json-resources branch has data in JSON format.
To know the time and date in Ryzom.
<base URL>/time.php
(optional), defaults ro raw.
raw
: Returns the tick. The server tick is a 32 bit integer that increases by one every 100 milliseconds.txt
: Returns a homine-readable string.xml
: Returns an xml file that contains all shard time information. The data is cached for 1 minute.
ryzom_time_api()
Returns SimpleXMLElement or boolean false on failure.
<shard_time>
<server_tick>514105152</server_tick>
<jena_year>2576</jena_year>
<day_of_jy>319</day_of_jy>
<month_of_jy>10</month_of_jy>
<cycle>0</cycle>
<day_of_cycle>319</day_of_cycle>
<month_of_cycle>10</month_of_cycle>
<day_of_month>19</day_of_month>
<day_of_week>1</day_of_week>
<season>3</season>
<day_of_season>49</day_of_season>
<time_of_day>13</time_of_day>
<txt_en>13h - Dua, Mystia 20, 1st AC 2576</txt_en>
<txt_fr>13h - Dua, Mystia 20, 1er CA 2576</txt_fr>
<txt_de>13h - Dua, Mystia 20, 1. AZ 2576</txt_de>
<cache created="1387437183" expire="1387437243"/>
</shard_time>
<?php
require_once "ryzomapi_lite.php";
$time = ryzom_time_api('xml');
if ($time !== false) {
$txt_en = htmlspecialchars($time->txt_en);
echo "Atys time is {$txt_en}";
} else {
echo "API failure";
}