Uploading a script using the REST API
Instructions and examples in this document use an IP address that is reserved for documentation, 192.0.2.5, as an example of the IP address for the switch. To access your switch, you must use the IP address or hostname of that switch.
You must be logged in to the switch REST API with a user name that has administrator rights.
The switch REST API access mode must be
read-write
.The script must be encoded in base64 format.
Scripts you download from the Aruba Solution Exchange website (instead of through the switch Web UI) or the GitHub repository are not in base64 format. You must encode those scripts before you upload them.
nae_scripts
resource collection.
For example:
POST https://192.0.2.5/rest/v1/system/nae_scripts
{
"name": "port_admin_state_monitor",
"expert_only":false,
"script": "<script_content_encoded_in_base64_format>"
}
In the example:
The name of the script is:
port_admin_state_monitor
The
expert_only
parameter indicates whether it is recommended that someone using the script have expert knowledge about the script. Typically, this parameter isfalse
.<script_content_encoded_in_base64_format> is the text string of the script after it is encoded in base64 format. For an example of a script in base64 encoded format, see Script example
If the filename, script name, and version in the script manifest matches a script that has already been uploaded, the upload fails with the message: “The specified script name and the version exists”