Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Redfish Examples

Basic Operations

Get Service Root

curl http://localhost:8080/redfish/v1/

List Systems

curl http://localhost:8080/redfish/v1/Systems

Get System Details

curl http://localhost:8080/redfish/v1/Systems/1

Power Control

Power On

curl -X POST http://localhost:8080/redfish/v1/Systems/1/Actions/ComputerSystem.Reset \
  -H "Content-Type: application/json" \
  -d '{"ResetType": "On"}'

Power Off

curl -X POST http://localhost:8080/redfish/v1/Systems/1/Actions/ComputerSystem.Reset \
  -H "Content-Type: application/json" \
  -d '{"ResetType": "GracefulShutdown"}'

Force Restart

curl -X POST http://localhost:8080/redfish/v1/Systems/1/Actions/ComputerSystem.Reset \
  -H "Content-Type: application/json" \
  -d '{"ResetType": "ForceRestart"}'

PATCH Operations

Update System Name

curl -X PATCH http://localhost:8080/redfish/v1/Systems/1 \
  -H "Content-Type: application/json" \
  -d '{"Name": "My Server"}'

Using Python

import requests

# Get service root
response = requests.get('http://localhost:8080/redfish/v1/')
print(response.json())

# Power on system
response = requests.post(
    'http://localhost:8080/redfish/v1/Systems/1/Actions/ComputerSystem.Reset',
    json={'ResetType': 'On'}
)
print(response.status_code)

Using PowerShell

# Get service root
Invoke-RestMethod -Uri 'http://localhost:8080/redfish/v1/'

# Power on system
$body = @{ ResetType = "On" } | ConvertTo-Json
Invoke-RestMethod -Method Post `
  -Uri 'http://localhost:8080/redfish/v1/Systems/1/Actions/ComputerSystem.Reset' `
  -Body $body `
  -ContentType 'application/json'