Red Hat Training

A Red Hat training course is available for Red Hat Satellite

Chapter 3. Examples

The following sections demostrate Red Hat Satellite API usage using different programming languages and their respective XML-RPC requests.

3.1. Perl Example

This Perl example shows the system.listUserSystems call being used to get a list of systems a user has access. The example prints the name of each system. The Frontier::Client Perl module is found in the perl-Frontier-RPC RPM.
#!/usr/bin/perl
use Frontier::Client;

my $HOST = 'satellite.example.com';
my $user = 'username';
my $pass = 'password';

my $client = new Frontier::Client(url => "http://$HOST/rpc/api");
my $session = $client->call('auth.login',$user, $pass);

my $systems = $client->call('system.listUserSystems', $session);
foreach my $system (@$systems) {
   print $system->{'name'}."\n";
}
$client->call('auth.logout', $session);