4 Replies Latest reply on Jun 21, 2018 8:15 AM by Wayne Burgett

    BNA 8.9: REST API - I get information on devices, but I need Serial Number. If I browse the GUI I see hardware information (Serial Number).  Can I get that via the REST API?

    Wayne Burgett

      The example here is from BMC web site.  Where do I find out how to add a device Serial number since that isn't a natural attribute in the device query?


      # extract the token and token type

      data = response.json()

      token = data["access_token"]

      tokenType = data["token_type"]


      # example of a follow on call using the token

      print "Getting all devices..."

      headers = {"Authorization": tokenType + " " + token}

      response = requests.get(service + "/v1.0/devices?limit=9000", headers=headers, verify=False)


      # parse the JSON and print the device names

      print "Retrieved devices:"

      data = response.json()


      for device in data:

          print device["name"]+" "+device["vendorName"]+" "+device["primaryInterfaceDeviceAgentName"]    ( would like to see device.hardware["serialNumber"]   for example )


      # logout and invalidate the token

      print "Logging out..."