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

Dell Unity™ Family Unisphere® Management REST API Programmer's Guide

PDF

Sorting response data

Use the orderby request parameter to specify sort criteria for one attribute in a list of resources returned by a collection query. The orderby parameter works like an SQL Order By clause. You can specify one of these sort orders for the attribute:

  • asc: (Default) Sorts the response data in ascending order.
  • desc: Sorts the response data in descending order.

Append the sort order to an attribute using an HTML space. For example:%20asc or %20desc.

If the request succeeds, it returns a 200 OK HTTP status code with requested resource information in the response body. If it does not succeed, it returns a 4nn or 5nn HTTP status code and a message entity.

Syntax

As the first parameter on the request URI: ?orderby=<orderby_expr>

As a subsequent parameter on the request URI: &orderby=<orderby_expr>

where <orderby_expr> is defined by the following syntax using Backus-Naur Form (BNF):

orderby_expr ::= sub_orderby_expr | orderby_expr ',' sub_orderby_expr sub_orderby_expr ::= prop_expr | prop_expr 'ASC'| prop_expr 'DESC'

where:

  • prop_expr is an attribute name defined for the resource being queried. Its type can be int, float, string, InetSocketAddress, Date, Boolean, Enum, or a list whose element is among the above types.
  • 'ASC'/'DESC' is case insensitive.
  • If a sort order is not specified, the default value is 'ASC'.
    NOTE You can use dot notation syntax (resource_type.attribute) in an orderby expression to sort responses by the value of an attributes from related a resource type. A related resource type is a resource type that is either referred to explicitly in the definition of the target resource type or embedded in the target resource type.

Example 1: Sorting drive information by drive name

The following request retrieves drive names and sizes, and sorts this information by name in ascending order.

Header
Accept: application/json 
Content-Type: application/json
Request
GET https://10.108.53.216/api/types/disk/instances?fields=name,size &orderby=name&compact=true
Response
{
  "@base": "https://10.108.53.216/api/types/disk/instances?fields=name,size&orderby=name&per_page=2000&compact=true",
  "updated": "2015-10-28T13:29:39.374Z",
  "links": [
    {
      "rel": "self",
      "href": "&page=1"
    }
  ],
  "entries": [
    {
      "content": {
        "id": "dpe_disk_0",
        "name": "DPE Disk 0",
        "size": 30565990400
      }
    },
    {
      "content": {
        "id": "dpe_disk_1",
        "name": "DPE Disk 1",
        "size": 30565990400
      }
    },
    {
      "content": {
        "id": "dpe_disk_2",
        "name": "DPE Disk 2",
        "size": 30565990400
      }
    },

.
.
.

Example 2: Sorting by attributes from a referenced resource type

The following request retrieves drive names and parent DPE names, and sorts this information by parent DPE name in ascending order.

Header
Accept: application/json 
Content-Type: application/json
Request
GET https://10.108.53.216/api/types/disk/instances?fields=name,parentDpe.name&orderby=parentDpe.name&compact=true
Response
{
  "@base": "https://10.108.53.216/api/types/disk/instances?fields=id,name,parentDpe.name,parentDpe.id&orderby=parentDpe.name&per_page=2000&compact=true",
  "updated": "2015-10-28T18:53:40.256Z",
  "links": [
    {
      "rel": "self",
      "href": "&page=1"
    }
  ],
  "entries": [
    {
      "content": {
        "id": "disk_0",
        "name": "Disk 0",
        "parentDpe": {
          "id": "dpe_a",
          "name": "DPE_A"
        }
      }
    },
    {
      "content": {
        "id": "disk_1",
        "name": "Disk 1",
        "parentDpe": {
          "id": "dpe_b",
          "name": "DPE_B"
        }
      }
    },
    {
      "content": {
        "id": "disk_2",
        "name": "Disk 2",
        "parentDpe": {
          "id": "dpe_c",
          "name": "DPE_C"
        }
      }
    },
    {
.
.
.

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: <>()\