CH-1164 Added drush command to get segments

Also, added response code check to getSegments and more complete error handling/error reporting
All callers of the method are wrapped in a try/catch