Skip to main content
  • Place orders quickly and easily
  • View orders and track your shipping status
  • Enjoy members-only rewards and discounts
  • Create and access a list of your products
  • Manage your Dell EMC sites, products, and product-level contacts using Company Administration.

Dell PowerStore REST API Developers Guide

PDF

Including data from a related resource type in a query

You can extend the scope of a collection query to retrieve data from a related resource type. The REST model describes two kinds of relations:

  • A referenced resource type
  • An embedded resource type

Referenced resource types

A referenced resource type describes an instance of a linked object type. This resource type is declared in the REST model as a reference to an object (for a many-to-one relation) or an array of objects (for a one-to-many or many-to-many relation). To return information about instances and their related instances, use the following syntax in the select parameter to specify the wanted attributes from the related resource type:

...<attribute1>,<attribute2>,<related_resource> (id,related_attribute2, related_attribute3...)

If you omit the list of parameters, only the select attribute and its value are returned for the referenced object:

...<attribute1>,<attribute2>,<related_resource>

Examples

The following queries use the select request parameter to return information about nodes and their related appliances.

Table 1. Example 1: Returning specified parameters for the appliance related to each nodeThis table shows an example request that uses the select parameter including the request headers, the actual request, and the response body to retrieve information about each node and its related appliances.
Component Details
Headers
Accept: application/json
Authorization: <auth_cookie>
Request
https://1.2.3.4/api/rest/node?select=id,name,appliance(id,name)
Response body
[
  {
    "id":"N1",
    "name":"H0112-appliance-1-node-A",
    "appliance":
      {
        "id":"A1",
        "name":"H0112-appliance-1"
      }
  }, 
  {
    "id":"N2",
    "name":"H0112-appliance-1-node-B",
    "appliance":
      {
        "id":"A1",
        "name":"H0112-appliance-1"
      }
  }
]
Table 2. Example 2: Returning only the id parameter for the appliance related to each node This table shows a request that returns only the ID parameter. The table includes the request headers, the actual request, and the response body.
Component Details
Headers
Accept: application/json
Authorization: <auth_cookie>
Request
https://1.2.3.4/api/rest/node?select=id,name,appliance
Response body
[
  {
    "id":"N1",
    "name":"H0112-appliance-1-node-A",
    "appliance":
      {
        "id":"A1"
      }
  }, 
  {
    "id":"N2",
    "name":"H0112-appliance-1-node-B",
    "appliance":
      {
        "id":"A1"
      }
  }
]
Table 3. Example 3: Returning specified parameters for all nodes related to an appliance This table shows a request that returns specified parameters for nodes that are related to an appliance. The table includes the request headers, the actual request, and the response body.
Component Details
Headers
Accept: application/json
Authorization: <auth_cookie>
Request
https://1.2.3.4/api/rest/appliance?select=id,name,nodes(id,name)
Response body
[
  {
    "id":"A1",
    "name":"H0112-appliance-1",
    "nodes":
      [
        {
          "id":"N1",
          "name":"H0112-appliance-1-node-A"
        },
        {
          "id":"N2",
          "name":"H0112-appliance-1-node-B"
        }
      ]
  }
]
Table 4. Example 4: Returning only the id parameter for all nodes related to an applianceThis table shows a request that returns the ID parameter for nodes that are related to an appliance. The table includes the request headers, the actual request, and the response body.
Component Details
Headers
Accept: application/json
Authorization: <auth_cookie>
Request
https://1.2.3.4/api/rest/appliance?select=id,name,nodes
Response body
[
  {
    "id":"A1",
    "name":"H0112-appliance-1",
    "nodes":
      [
        {
          "id":"N1"
        }, 
        {
          "id":"N2"
        }
      ]
  }
]

Embedded resource types

An embedded resource type describes an instance of nested objects. This resource type is declared in the REST model as a reference to an object or an array of objects with a special note in its description field.

  • Embedded resources cannot be queried without a parent object.
  • Embedded resources always return all fields. These objects do not allow the user to select which fields to return.

Use the following syntax in the select parameter to query an embedded resource type:

...<attribute1>,<attribute2>,<embedded_resource>
NOTE:Extending the scope of a collection query is not supported for all resources. Resources that do not support this functionality include a note in their description stating: Filtering on the fields of this embedded resource is not supported.

In addition, you can display selected attributes of an embedded resource:

...<attribute1>,<attribute2>,<embedded_resource>->>embedded_attribute1,<embedded_resource>->>embedded_attribute2...
Table 5. Example 5: Querying the protection data information for a volumThis table shows a request that returns the volume protection data information. The table includes the request headers, the actual request, and the response body.
Component Details
Headers
Accept: application/json
Authorization: <auth_cookie>
Request
https://1.2.3.4/api/rest/volume?select=id,protection_data
Response body
[
  {
    "id":"3f6208d1-b325-4901-9fc1-9e82d943b857",
    "protection_data":
      {
        "family_id": "3f6208d1-b325-4901-9fc1-9e82d943b857", 
        "parent_id": null,
        "source_id": null, 
        "creator_type": "User", 
        "copy_signature": null, 
        "source_timestamp": null, 
        "creator_type_l10n": "User", 
        "is_app_consistent": null, 
        "created_by_rule_id": null, 
        "created_by_rule_name": null, 
        "expiration_timestamp": null
      }
  }, 
  {
    "id":"9d102db7-048d-4d24-85c2-28c7a5fc91ee",
    "protection_data":
      {
        "family_id": "9d102db7-048d-4d24-85c2-28c7a5fc91ee", 
        "parent_id": null, 
        "source_id": null, 
        "creator_type": "User", 
        "copy_signature": null, 
        "source_timestamp": null, 
        "creator_type_l10n": "User", 
        "is_app_consistent": null, 
        "created_by_rule_id": null, 
        "created_by_rule_name": null, 
        "expiration_timestamp": null
      }
  }, 
  {
    "id":"f0480b0f-cc6f-431b-9e18-e4b39b2b13e1",
    "protection_data":
      {
        "family_id": "f0480b0f-cc6f-431b-9e18-e4b39b2b13e1", 
        "parent_id": null, 
        "source_id": null, 
        "creator_type": "User", 
        "copy_signature": null, 
        "source_timestamp": null, 
        "creator_type_l10n": "User", 
        "is_app_consistent": null, 
        "created_by_rule_id": null, 
        "created_by_rule_name": null, 
        "expiration_timestamp": null
      }
  }
]

Rate this content

Accurate
Useful
Easy to understand
Was this article helpful?
0/3000 characters
  Please provide ratings (1-5 stars).
  Please provide ratings (1-5 stars).
  Please provide ratings (1-5 stars).
  Please select whether the article was helpful or not.
  Comments cannot contain these special characters: <>()\