May 29, 2011

Just wanted to give a quick shoutout to gsxcl. It started out as a simple test tool for gsxlib, but has now evolved into a pretty useful replacement for GSX’s web UI. Currently it supports the following operations:

  • Warranty status
  • Part lookups
  • Checking repair details and status
  • Downloading part return labels

That’s right - you can even use this to quickly download the return label of a part as a PDF:

./gsxcl -u username -p password -s sold-to -m label -q return-order:part-number > test.pdf
file ./test.pdf
test.pdf: PDF document, version 1.4

The operating principle is that -m defines the “mode” of operation and then everything after -q should supply the necessary arguments. Multiple arguments are separated with a colon, as for example in the label download command - we must supply both the return order number (starting with 7…) and the part number being returned.

usage: gsxcl -s sold-to -u username -p password [-r region] [-e environment] [-f format] [-m mode] [-q query]
-s  sold-to           your GSX Sold-To account
-u  username    the Apple ID with GSX WS API access
-p  password    the password for the Apple ID
-r  region           either "am" (America), "emea" (default, Europe, Middle-East, Africa) "apac" (Asia-Pacific) or "la" (Latin America)
-e  environment the GSX environment. Either empty (production), "it" or "ut" Defaults to production
-f  format          the output format. Either print_r (default), json, xml or csv
-m  mode          what to search for. Currently one of: warranty, parts, pending, repair, lookup, status, label.
              Defaults to "warranty"
-q  query           a query string (serial number, order confirmation, repair number, EEE code, etc
              Defaults to this machine's serial number

One of the most recent changes I added was the format option, allowing you to get data out of it in CSV, XML or just a PHP print_r(). The CSV option is probably the most useful one, the header row is constructed from all the property names of the GSX WS response.

Running it with just the required arguments will perform a warranty status check for the current machine.