cis data svc resource model: query
Request:
HTTP request
Request Body Structure:
"query_spec" : {
"resource_models" : [
"string",
"string"
],
"filter" : {
"criteria" : [
{
"comparable_value" : "opaque_string_value",
"property" : "string",
"comparable_list" : [
"opaque_string_value",
"opaque_string_value"
],
"operator" : "EQUAL"
},
{
"comparable_value" : "opaque_string_value",
"property" : "string",
"comparable_list" : [
"opaque_string_value",
"opaque_string_value"
],
"operator" : "EQUAL"
}
],
"operator" : "AND"
},
"sort_criteria" : [
{
"sort_direction" : "ASCENDING",
"property" : "string"
},
{
"sort_direction" : "ASCENDING",
"property" : "string"
}
],
"limit" : 1,
"properties" : [
"string",
"string"
]
}
}
Request Body Parameters:
Name | Type | Description |
---|---|---|
bold = required | ||
query_spec | query_spec | The query that defines the resource model data to retrieve. |
query_spec.properties | string[] | The names of the (resource model) properties to be included in the result set for the query. Each property name could be either a single property name, in case of an immediate property of the resource model or a property path, i.e. chain of property names, separated with In case a requested property is present in more than one of the queried resource models (specified in cis.data.svc.resource_model.query_spec.resource_models) the property name should be prefixed by the fully-qualified name of the resource model of interest, followed by Corresponds to the The list must not be empty. Otherwise, vapi.std.errors.invalid_argument error will be thrown. |
query_spec.resource_models | string[] | The names of the resource models to be queried. All properties used in the query should belong to one of those resource models. If a property from another model is used somewhere else in the query an vapi.std.errors.invalid_argument error will be thrown to indicate this violation. Multiple resource models could be specified here only if they all belong to the same resource type. In case multiple resoruce models are specified they are implicitly joined on their primary key @modelKey property. Each resource model name should be fully-qualified, e.g. Corresponds to the The list must not be empty. Otherwise, vapi.std.errors.invalid_argument error will be thrown. |
query_spec.filter | filter | Restricts (filters) the set of resource models whose properties should be returned based on conditions/predicates on their property values. Corresponds to the FROM clause). |
query_spec.filter.criteria | property_predicate[] | A set of conditions on the resource model properties that together define the criteria for filtering/matching the resources whose data to retrieve. The list must not be empty. Otherwise, vapi.std.errors.invalid_argument error will be thrown. |
query_spec.filter.criteria[].property | string | Specifies the resource model property to be compared. The property name could be either a single property name, in case of an immediate property of the resource model or a property path, i.e. chain of property names, separated with In case the specified property is present in more than one of the queried resource models (specified in cis.data.svc.resource_model.query_spec.resource_models) the property name should be prefixed by the fully-qualified name of the resource model of interest, followed by |
query_spec.filter.criteria[].operator | string | The operator to use for comparison of the property value. Defines the possible operators to use when comparing the values of individual resource model properties. When comparing values of different types, one of the values can be promoted from one type to another (if needed in order to perform correct comparison) according to the following rules:
EQUAL: Equality operator NOT_EQUAL: Inequality operator GREATER: Greater than operator GREATER_OR_EQUAL: Greater than or equal to operator LESS: Less than operator LESS_OR_EQUAL: Less than or equal to operator IN: Checks for equality with at least one of a list of values |
query_spec.filter.criteria[].comparable_value | opaque | The primitive value that the property should be compared to. Note that only the following primitive value types could be used for comparison:
Please, note that when comparing with resource identifier, i.e. @modelKey property, the comparable value should be of string type. Optional. It is only relevant when operator has value [EQUAL, NOT_EQUAL, GREATER, GREATER_OR_EQUAL, LESS, LESS_OR_EQUAL]. This field is optional and it is only relevant when the value ofoperator is one of EQUAL, NOT_EQUAL, GREATER, GREATER_OR_EQUAL, LESS, or LESS_OR_EQUAL. |
query_spec.filter.criteria[].comparable_list | opaque[] | The list of primitive values to test for equality with the property value when operator IN is used. The list cannot be empty. See cis.data.svc.resource_model.property_predicate.comparable_value for the list of allowable primitive value types. Optional. It is only relevant when operator has value IN. This field is optional and it is only relevant when the value of operator is IN. |
query_spec.filter.operator | string | The logical operator which defines how the property predicates should be combined in order to filter a given resource. Optional. If unset, defaults to AND . |
query_spec.sort_criteria | sort_criterion[] | Defines how the final result set should be sorted by comparing the values of one or more properties of the items in the result set. Represents a list of one or more sorting criteria, where those with lower indices in the list takes precedence over the specs with higher indices. Corresponds to the |
query_spec.limit | long | The maximum number of result items to return. Could be used only if sorting criteria cis.data.svc.resource_model.query_spec.sort_criteria is applied. If used, the value should be positive integer. Optional. If unset, all resources will be returned. Note that the service defines its own limit that cannot be overriden here. If the more resources than this default limit, an vapi.std.errors.invalid_argument error will be thrown. |
Response:
HTTP Status Code: 200
Representation:
"value" : {
"items" : [
{
"property_values" : [
"opaque_string_value",
"opaque_string_value"
]
},
{
"property_values" : [
"opaque_string_value",
"opaque_string_value"
]
}
],
"properties" : [
"string",
"string"
]
}
}
Response Type:
Name | Type | Description |
---|---|---|
bold = required | ||
value | result_set | The resource model data retrieved for the provided query. |
value.properties | string[] | The names of the (resource model) properties (as requested in cis.data.svc.resource_model.query_spec.properties) returned for each resource item in the result set. The position (index) of each model property in this list corresponds to the position of the model property value in each resource item's values list. That is, the name of each resource model property in the cis.data.svc.resource_model.resource_item.property_values list is given by the string with the same index (position) in this list. Could be empty only in case the cis.data.svc.resource_model.result_set.items list is empty. |
value.items | resource_item[] | The list of result items. Each item corresponds to a particular resource that matched the conditions in the specified cis.data.svc.resource_model.query_spec instance and containing the property data retrieved for that resource. Could be empty if no items matched the query. |
value.items[].property_values | opaque[] | The model property values for the resource. The name of each model property value is given by the model property name with the same index in cis.data.svc.resource_model.result_set.properties. In other words, the position of a property value in this list should be the same as the position of the property in the cis.data.svc.resource_model.result_set.properties list. A property value may be unset if the respective property is unset or doesn't exist for the resource. For example, if the optional VirtualMachine/config property is unset then its child property VirtualMachine/config/modified doesn't exist; they both will manifest as unset values in the property_values list. |
Errors:
HTTP Status Code | Type | Description |
---|---|---|
400 | invalid_argument | If cis.data.svc.resource_model.query_spec.limit value is not positive or is greater than the default limit. |
401 | unauthenticated | If a session has not been created, has expired due to inactivity or explicit log out, or if a session the service itself has created with an underlying data provider has expired and cannot be reestablished. In all cases the client should login again and retry the query. |