GET method usage and considerations
The GET method is a read method that gets the resource specified by the URI.
Data is returned in JSON format in the response body.
GET on a resource collection returns a list of resource URIs
Using GET on a resource collection results in a list of URIs. Each URI in the list corresponds to a specific resource in the collection.
The following example shows a GET request to the
vlans
collection. The response body is a list—in JSON format—of the configured VLANs. Each VLAN resource is listed in URI format.
$ curl GET -k -b /tmp/auth_cookie "https://10.17.0.1/rest/v1/system/bridge/vlans" [ "/rest/v1/system/bridge/vlans/1", "/rest/v1/system/bridge/vlans/10", "/rest/v1/system/bridge/vlans/20" ]
GET on a resource returns the attributes of that resource
GET on a specific resource returns the attributes of that resource.
The following example shows a GET request on VLAN 10. The URI for VLAN 10 specifies resource ID 10 in the
vlans
collection.
The response body is the representation of VLAN 10 in JSON format. In response bodies, references to other resources are represented as URIs. For example, VLAN 10 has an attribute called
flood_enabled_subsystems
, that has a value that is a list of subsystems represented as a URI.
$ curl GET -k -b /tmp/auth_cookie "https://10.17.0.1/rest/v1/system/bridge/vlans/10" { "id": 10, "name": "vlan10", "type": "static", "flood_enabled_subsystems": [ "/rest/v1/system/subsystems/system/base" ], … }