Using the REST API with systeminfo.xml

Version 1

    For anyone interested in seeing the systeminfo.xml with python (should work for powershell or whatever as well), you may have found that you'll get a 403 (Forbidden) error. It appears that if you don't log in and grab a session cookie, the URI request will fail.

    After some fiddlering, here's what I found... and it appears to also work without the "Referrer_IP" being set (helpful in my world, but maybe annoying for security hawks).

    Here's what I did... add this function to your script

     

    def status(SERVER, TOKEN):
      check = SERVER + "/admin/systeminfo.xml"
      print("Status for {}".format(check))
      try:
        x = requests.get(check, headers={
          "Cookie": 'workgroup_session_id={}'.format(TOKEN)
          }, verify=False)
      except:
        x = ('none',)
        pass
      return x.text

     

    • Use the REST API to sign in. it seems to work with Server or Site admin privileges. Set TOKEN variable as you would for any other REST call.
    • Set your server name as the SERVER variable
    • In your script call

         print(status(SERVER, TOKEN))

     

    That should do it.

    The main take away here is using the API login token as the "Workgroup_session_id" cookie, which you can set as you do any other header value.

    enjoy.