All modules receive <request/>, process it, and return
<response/>.
In case of API error, <API_error/> is
returned. <API_error/> will have “description” attribute.
<API_error/> will also have a variable “APIs” (list_str)
attached to it, to ease debugging.
<request/> has a <function_call/> and “API_version”
(required) and “sequence” (optional) attributes. “sequence”
is not used by module; it is just passed back thru <response/>
tag.
<response/> has a <function_response/> and
“API_version” and “sequence” attributes.
<function_call/>:
Functions are invoked using this tag.
“function_call” has to have “name” attribute. See respective
module description for functions.
<function_call/> receives <var/>s as input. See
Variables for <var/> description.
<function_response/>:
<function_response/>
will have “function_name” attribute, and returned <var/>s
attached to it. Variables are defined by respective function calls.
There will always be a “success” (boolean) variable
in <function_response/>, besides function return values.
If
function was successfully executed, “success” will be “true”;
otherwise, “success” will be “false” and two additional
variables will be attached: “error_code” (int) and
“error_description” (string).
Error codes are defined by
respective module functions; exception is generic_error (-1) which
covers all other errors.
Error descriptions are human readable
descriptions of error; exception is generic error whose description
might be too primitive for end-user consumption.
Common functions:
APIs
Retrieve list of supported API versions.
No input variables.
Output variables:
- “APIs” (list_str) –
list of supported APIs
On failure:
- No special errors defined, only
generic ones might get returned.
Sample function without input vars:
<request API_version="1.0" sequence="1254">
<function_call name="APIs"/>
</request>
<response API_version="1.0" sequence="1254">
<function_response function_name="APIs">
<var mutable="false" name="APIs" type="list_str">
<listentry value="1.0"/>
</var> <var mutable="false" name="success" type="boolean" value="true"/>
</function_response>
</response>
Sample function from “rpm” module that takes “search” variable:
<request API_version="1.0" sequence="1254">
<function_call name="query">
<var mutable="false" name="search" type="list_xml">
<rpm name=”gedit”/>
</var>
</function_call>
</request>
<response API_version="1.0" sequence="1254">
<function_response function_name="query">
<var mutable="false" name="result" type="list_xml">
<rpm description="" name="gedit" repo_version="2.8.1-4" summary="" version="2.8.1-4"/>
</var> <var mutable="false" name="success" type="boolean" value="true"/>
</function_response>
</response>