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.
- Perl Modules
- JSON or JSON::XS
Download the full source code.
- Start a new perl script.
- 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.
- Configure the script for your particular gateway
- Log in to your gateway. This will save your authentication cookies in your HTTP::Cookies object so that subsequent calls will be allowed.
- Build a call to the gateway.list method to get information about the gateway.
- Shut the gateway down remotely using system_shutdown.save.