By default, all fields of a resource representation are returned in a response to a GET
request. To limit the number of fields returned, the fields
query
parameter can be used in one of two ways. To request a subset of fields, supply the
fields
query parameter with a list of field names. For example, the
following request instructs the API to return the id
,
type
, name
, and range
fields of
Network resources in the global collection. It also returns the id
and
name
fields of each Network resource's inlined Configuration
resource.
Request:
GET http://{Address_Manager_IP}/api/v2/networks?fields=id,type,name,range,configuration.id,configuration.name
Authorization: Basic {basicAuthenticationCredentials}
Response:
HTTP/1.1 200 OK
Content-Type: application/hal+json
{
"count": 2,
"data": [
{
"id": 100922,
"type": "IPv6Network",
"name": "My IPv6 Network",
"configuration": {
"id": 100881,
"name": "Default"
},
"range": "2A00:23C6:A890:5001::/64"
},
{
"id": 100923,
"type": "IPv4Network",
"name": "My Home Network",
"configuration": {
"id": 100881,
"name": "Default"
},
"range": "192.168.1.0/24"
}
]
}
Alternatively, a request can specify only the fields it does not want included in
the resource representation using the not
operator. The following
request instructs the API to return all fields for View resources of a particular
Configuration except for the id
and _links
fields.
GET http://{Address_Manager_IP}/api/v2/configurations/100882/views?fields=not(id,_links)