Appendix A.RHN API AccessIn an effort to provide customers with added flexibility, RHN makes an application programminginterface (API) available. This interface can be found by clicking Help at the top-right corner ofthe RHN website, then clicking API in the left navigation bar. Or you may go directly to:https://rhn.redhat.com/rpc/api/. You should use this URL for your XMLRPC server, as well as yourbrowser.WarningThis API should be considered experimental and used strictly for evaluation by advanced users. RedHat strongly discourages you from using this interface to alter production systems, unless you aresure your changes will not result in errors.The RHN API is based upon XML-RPC, which allows distinct pieces of software on disparate systemsto make remote procedure calls using XML over HTTP. For this reason, any calls you make areexpected to meet the constraints of XML-RPC. You can find out more at http://www.xmlrpc.com/.Because the RHN API is self-documenting and subject to change, this section bypasses a list of classesand methods (which can be found within the interface) in favor of tips for using the API efficiently.These include steps for determining required values and a sample script that makes some of the calls.A.1. Using the auth Class and Getting the SessionIt is worth noting you will almost invariably use the auth class first. This class offers a single method,login. Use this to establish an RHN session. It requires values for three parameters: username, pass-word, and duration. The first two come directly from your RHN account, while the third is the lengthof time the session should last in seconds, typically 1200. It will return a session string than can beused in all other methods.A.2. Obtaining the system_idMany of the methods require a value for the system_id parameter. This is the uniquealphanumeric value assigned to each system when registered to RHN. It can be found withinthe /etc/sysconfig/rhn/systemid file on the machine. In addition, you may use thedownload_system_id method within the system class to obtain the value.A.3. Determining the sidSeveral methods require a value for the sid, or server ID, parameter. Note that this is different fromthe system_id. You may determine the sid of a machine in two different ways. First, you can log intothe RHN website, click the name of a system, and view the sid at the end of the URL in the locationbar. It will be after the equal (=) sign in something like, "index.pxt?sid=1003486534". Second, youmay use the list_user_systems method within the system class to obtain a list of systems available tothe user that contains the associated sids.