Best practice method for building the PUT request body

Hewlett Packard Enterprise recommends the following procedure for building the PUT request body for requests that use the REST v1 API.

Procedure
  1. Use the GET method with selector=configuration to obtain the configuration attributes for the resource you want to change.

    For example:

    GET "https://192.0.2.5/rest/v1/system/ports/vlan200?selector=configuration"
  2. Compare the response body from the GET request to the JSON model for the PUT request shown in the ArubaOS-CX REST API Reference. Remove all attribute-value pairs that are not included in the PUT JSON model.

    The request body you send using the PUT method must match the JSON model shown for the PUT method—which is not the same as the JSON model for the POST or GET method. The JSON models for the GET and POST methods include both mutable and immutable attributes. The JSON model for the PUT method contains only the mutable attributes.

    TIP:

    Unlike the REST v1 API, the REST v10.04 API GET method has a selector=writable parameter, which enables you to get only the mutable (writable) configuration attributes of a resource.

  3. Change the values of the attributes to match your wanted configuration.
  4. Use the resulting JSON data as the request body for the PUT request.