Skip to end of metadata
Go to start of metadata

Here is an example Perl script which uses the API to print some information about the gateway and shut it down. The completed script (with shutdown code commented out for safety) is available as an attachment on this page.

Requirements

  • Perl
  • OpenSSL
  • Perl Modules
    • LWP::UserAgent
      • Crypt::SSLeay
    • HTTP::Cookies
    • JSON or JSON::XS

Code

Download the full source code.

  1. Start a new perl script.
  2. Create a new LWP::UserAgent object, and disable SSL certificate hostname verification, which is on by default in recent versions. Create a new HTTP::Cookies object and tell your user agent about it.
  3. Configure the script for your particular gateway
  4. Log in to your gateway. This will save your authentication cookies in your HTTP::Cookies object so that subsequent calls will be allowed.
  5. Build a call to the gateway.list method to get information about the gateway.
  6. Shut the gateway down remotely using system_shutdown.save.
  • No labels