diff options
author | George Keishing <gkeishin@in.ibm.com> | 2017-12-13 11:12:36 -0600 |
---|---|---|
committer | George Keishing <gkeishin@in.ibm.com> | 2018-01-10 11:50:31 -0600 |
commit | f1ee823db937f61688c6770de018cb0b91f593a5 (patch) | |
tree | 83527bcb8302b669ae7b249d16289719a6c28c99 | |
parent | e28e782ac960b36f0285bd52806185f59c31ad13 (diff) | |
download | openbmc-docs-f1ee823db937f61688c6770de018cb0b91f593a5.tar.gz openbmc-docs-f1ee823db937f61688c6770de018cb0b91f593a5.zip |
REST cheat sheet initial commit
Added:
- REST client curl commands.
Change-Id: Ie3d8beaed7da456544a9c8a949d2b5003829c0c3
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
-rw-r--r-- | REST-cheatsheet.md | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/REST-cheatsheet.md b/REST-cheatsheet.md new file mode 100644 index 0000000..3c2ead0 --- /dev/null +++ b/REST-cheatsheet.md @@ -0,0 +1,54 @@ +# OpenBMC REST cheat sheet + +This document is intended to provide a set of REST client commands for OpenBMC usage. + +## Using CURL commands +* Establish REST connection session: + ``` + $ export bmc=xx.xx.xx.xx + $ curl -c cjar -b cjar -k -H "Content-Type: application/json" -X POST https://${bmc}/login -d "{\"data\": [ \"root\", \"0penBmc\" ] }" + ``` + +* List and enumerate: + ``` + $ curl -c cjar -b cjar -k -H "Content-Type: application/json" https://${bmc}/xyz/openbmc_project/list + $ curl -c cjar -b cjar -k -H "Content-Type: application/json" https://${bmc}/xyz/openbmc_project/enumerate + ``` + +* List sub-objects: + ``` + $ curl -c cjar -b cjar -k -H "Content-Type: application/json" https://${bmc}/xyz/openbmc_project/ + $ curl -c cjar -b cjar -k -H "Content-Type: application/json" https://${bmc}/xyz/openbmc_project/state/ + ``` + +* Host soft power off: + ``` + $ curl -c cjar -b cjar -k -H "Content-Type: application/json" -d '{"data": "xyz.openbmc_project.State.Host.Transition.Off"}' -X PUT https://${bmc}/xyz/openbmc_project/state/host0/attr/RequestedHostTransition + ``` + +* Host hard power off: + ``` + $ curl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT -d '{"data":"xyz.openbmc_project.State.Chassis.Transition.Off"}' https://${bmc}//xyz/openbmc_project/state/chassis0/attr/RequestedPowerTransition + ``` +* Host power on: + ``` + $ curl -c cjar -b cjar -k -H "Content-Type: application/json" -d '{"data": "xyz.openbmc_project.State.Host.Transition.On"}' -X PUT https://${bmc}/xyz/openbmc_project/state/host0/attr/RequestedHostTransition + ``` + +* Reboot BMC: + ``` + $ curl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT -d '{"data":"xyz.openbmc_project.State.BMC.Transition.Reboot"}' https://${bmc}//xyz/openbmc_project/state/bmc0/attr/RequestedBMCTransition + ``` +* Delete logging entries: + ``` + $ curl -c cjar -b cjar -k -H "Content-Type: application/json" -X DELETE https://${bmc}/xyz/openbmc_project/logging/entry/<entry_id> + $ curl -b cjar -k -H 'Content-Type: application/json' -X POST -d '{"data":[]}' https://${bmc}/xyz/openbmc_project/logging/action/DeleteAll + ``` +* Set boot mode: + ``` + $ curl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT https://${bmc}/xyz/openbmc_project/control/host0/boot/one_time/attr/BootMode -d '{"data": "xy.openbmc_project.Control.Boot.Mode.Modes.Regular"}' + ``` +* Set boot source: + ``` + $ curl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT https://${bmc}/xyz/openbmc_project/control/host0/boot/one_time/attr/BootSource -d '{"data": "xyz.openbmc_project.Control.Boot.Source.Sources.Default"} + ``` |