Chapter 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
authnamespace groups authentication function, or theerratanamespace 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
loginmethod in theauthnamespace 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
loginmethod in theauthnamespace requiresusernameandpasswordparameters to specify the login details of a certain user. Theloginmethod also accepts an optionaldurationparameter to specify the length of time until the user session expires..
The XML-encoded request usually appears in the following structure:
For example, use the following XML-RPC request to retrieve a list of all Red Hat Satellite API namespaces:
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:
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 Part II, “Examples”.
For more information about XML-RPC, see http://www.xmlrpc.com/.