Moab Web Services > Resources > Distinct

Distinct

The Distinct resource enables clients to retrieve distinct (unique) values from another MWS resource. For example, a client can request the list of all featuresReported across all nodes like this:

GET http://localhost:8080/mws/rest/distinct/nodes/featuresReported/?api-version=3

Supported methods

Resource GET PUT POST DELETE
/rest/distinct/<resource>/<field> Get Distinct Values -- -- --

This topic contains these sections:

Get Distinct Values

The HTTP GET method is used to retrieve distinct values from another MWS resource.

URLs and parameters

GET http://localhost:8080/mws/rest/distinct/<resource>/<field>?api-version=3
Parameter Required Type Valid values Example
resource Yes String The MWS resource to query. nodes
field Yes String The field for which to return the distinct values. featuresReported
query No JSON Determines the subset of objects from which to retrieve the distinct values. query={"states.powerState": "On"}

The Distinct resource has no access control of its own. Rather, it depends on the access control of the MWS resource being queried.

For example, for a client to run a query like /rest/distinct/nodes/featuresReported, it must have GET rights on the Nodes resource. For more information, see Access Control.

Examples

Example 4-3: Get all featuresReported across all nodes

http://localhost:8080/mws/rest/distinct/nodes/featuresReported?api-version=3
------------------------------------

{ 
  "totalCount": 1,
  "resultCount": 1,
  "results": ["vlan1"]
}

Example 4-4: Get all available operating system images across all nodes that are powered on

http://localhost:8080/mws/rest/distinct/nodes/operatingSystem.imagesAvailable?api-version=3&query={"states.powerState": "On"}
------------------------------------

{
  "totalCount": 2,
  "resultCount": 2,
  "results":   [
    "linux",
    "windows"
  ]
}

Related Topics 

© 2015 Adaptive Computing