Skip to content

Instantly share code, notes, and snippets.

@tadeboro
Last active August 1, 2019 07:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tadeboro/ba53774afa184a02ca985dd7e359bc6e to your computer and use it in GitHub Desktop.
Save tadeboro/ba53774afa184a02ca985dd7e359bc6e to your computer and use it in GitHub Desktop.
Manually inspecting Redfish API responses

Redfish API debugging

Debugging the Redfish API is relatively easy since JSON is at least partially human-readable (programmer-readable maybe? ;).

Manually inspecting Redfish responses

Inspect the Redfish API responses using curl is relatively simple. We start by running this:

curl -k -u 'username:password' https://redfish.api/redfish/v1/ | jq

We can also leave out the | jq part if we do not have the jq program installed and we do not care about the prettiness of the output.

The response that we get back from the service should look something like this (we shortened the response somewhat to keep the document reasonably-sized):

{
  "@odata.context": "/redfish/v1/$metadata#ServiceRoot.ServiceRoot",
  "@odata.id": "/redfish/v1",
  "@odata.type": "#ServiceRoot.v1_5_0.ServiceRoot",
  "Chassis": {
    "@odata.id": "/redfish/v1/Chassis"
  },
  "Links": {
    "Sessions": {
      "@odata.id": "/redfish/v1/SessionService/Sessions"
    }
  },
  "Managers": {
    "@odata.id": "/redfish/v1/Managers"
  },
  "Name": "HPE RESTful Root Service",
  "Product": "ProLiant DL360 Gen10",
  "SessionService": {
    "@odata.id": "/redfish/v1/SessionService"
  },
  "Systems": {
    "@odata.id": "/redfish/v1/Systems"
  }
}

Now we can follow the links in response to get to the information we need. For example, to get information about the systems, we can run:

curl -k -u 'username:password' https://redfish.api/redfish/v1/Systems | jq

And again, we get back a JSON that should contain something similar to this:

{
  "Description": "Computer Systems view",
  "Name": "Computer Systems",
  "Members": [
    {
      "@odata.id": "/redfish/v1/Systems/1"
    }
  ],
  "Members@odata.count": 1
}

Now rinse and repeat ;)

FAQ

  1. Why are some fields missing from the Redfish API responses? Most of the fields described in the Redfish standard are optional. So make sure you can handle the missing fields.
  2. What can I do if some field is missing? You should check with your vendor if the required information is available via Redfish API. You may also need to update the BMC software to get the latest features available.
  3. How do I know if the data field is optional? You need to read the CSDL schemas that are available from the Redfish API web page. Good luck!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment