Example: Firmware upgrade using REST APIs

Uploading a file to the secondary firmware image

In the following example, a curl command is used to upload the firmware image file from the local workstation to the switch and post that file as the secondary firmware image. The -F option specifies that the POST method is used to upload the file.

$ curl -k -b /tmp/auth_cookie \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
-F "fileupload=@/myfirmwarefiles/myswitchfirmware_2017020905.swi" \  
https://192.0.2.5/rest/v1/firmware?image=secondary

Booting the system using the secondary firmware image

Method and URL:

POST "https://192.0.2.5/rest/v1/boot?image=secondary"

Example curl command:

$ curl -k POST -b /tmp/auth_cookie \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
"https://192.0.2.5/rest/v1/boot?image=secondary"