REST API access modes

The REST API supports two access modes:

  • read-write (default)

  • read-only

The defaultread-writeaccess mode is not displayed in theshow running-configurationcommand. You can change the access mode to read-only using thehttps-server rest access-mode read-onlyCLI command from the global configuration (config) context. You can validate the mode set using theshow https-servercommand.

Read-write access mode

In the read-write access mode:

  • TheAOS-CXREST API Reference shows most of the supported read and write methods for all switch resources.

  • The REST API can access and change every configurable aspect of the switch as modeled in the configuration and state database.

    CAUTION:

    REST API是强大的,但必须使用的前女友treme caution: For most values, no semantic validation is performed on the data that you write to the database, and configuration errors can destabilize the switch.

Read-only access mode

In the read-only access mode:

  • Most switch resources support only GET methods, but some resources allow PUT or POST methods. For example, you can use POST to log into the switch, use PUT to upload a new running configuration, or use POST to upload a new firmware version.

  • For most switch resources, theAOS-CXREST API Reference does not show any write methods (POST, PUT, and DELETE) the resource might support. To show those write methods, read-write mode must be enabled.