Red Hat Training

A Red Hat training course is available for Red Hat Satellite

1.2. Using XML-RPC with the Red Hat Satellite API

XML-RPC uses HTTP to send an XML-encoded request to a server. The request contains the following:
Namespace
A namespace is a grouping of methods based upon a particular function, object or resource. For example, the auth namespace groups authentication function, or the errata namespace groups function that control errata.
Method
A method represents a certain action. Each method controls a specific function of the Red Hat Satellite. For example, the login method in the auth namespace logs a user into Red Hat Satellite and returns a session key.
Parameter
A parameter is a piece of input to control specific aspects of a method. For example, the login method in the auth namespace requires username and password parameters to specify the login details of a certain user. The login method also accepts an optional duration parameter to specify the length of time until the user session expires..
The XML-encoded request usually appears in the following structure:
<methodCall>
  <methodName>namespace.method</methodName>
  <params>
    <param>
      <value><name>parameter</name></value>
    </param>
    <param>
      <value><name>parameter</name></value>
    </param>
    ...
  </params>
</methodCall>
For example, use the following XML-RPC request to login to the API and request a session key for authentication:
<methodCall>
  <methodName>auth.login</methodName>
  <params>
    <param>
      <value><username>admin</username></value>
    </param>
    <param>
      <value><password>p@55w0rd!</password></value>
    </param>
  </params>
</methodCall>
In this example, the request sends the username and password as a parameters to the login method, which is a part of the auth namespace. The Satellite server returns the following response:
<methodResponse>
  <params>
    <param>
      <value><sessionKey>83d8b35f</sessionKey></value>
    </param>
  </params>
</methodResponse>
The response contains a returned parameter for sessionKey, which is a key used to authenticate most of the API methods.
Most programming languages include XML-RPC modules and libraries that automatically parse the desired method and parameters into the XML-encoded request and parse the resulting response as returned variable. For examples, see Chapter 2, Examples.
For more information about XML-RPC, see http://www.xmlrpc.com/.