Return Assets by Query
/mobile/platform/location/assets/query
Call this operation to retrieve the assets that match the query parameters that you specify in the request body.
Permissions
You can access this operation as a social user, a virtual user, an anonymous user, or a mobile user. If you access this operation as a mobile user, then you must be a member of the realm that's associated with the mobile backend.
Request
- application/json
objectQuery Parameters-
associatedDeviceId(optional):
integer
Return the asset associated with this device ID. When you use this query parameter, don't combine it with other parameters.
-
attributes(optional):
object Attributes
Title:
AttributesAdditional Properties Allowed: additionalPropertiesThe attributes entered in the MCS UI, as key/value pairs. -
description(optional):
string
Filter the items based on a case-insensitive partial match of this string with the asset's description.
-
format(optional):
string
Default Value:
longAllowed Values:[ "short", "long" ]The response is in long format by default. Specify `short` to return only the `id`, `name`, `description`, and `label` properties. -
label(optional):
string
Filter results based on a partial match of this string with the label.
-
limit(optional):
integer
Minimum Value:
0Maximum Value:500Default Value:40Maximum number of items to return (between 0 and 500). If the requested limit is greater than `500`, then `500` is substituted. -
listOfAssets(optional):
array listOfAssets
Asset ID(s) to search for. For example `[15,16]`.
-
name(optional):
string
Filter results based on a case-insensitive partial match of this string with the asset's user-defined name.
-
offset(optional):
integer
Default Value:
0Zero-based index of the first item to return. -
orderBy(optional):
string
Allowed Values:
[ "name", "label", "createdOn", "modifiedOn" ]Field to order results by. Requires either `:asc` for ascending or `:desc` for descending. Example: `createdOn:asc`. -
search(optional):
string
Filter results based on a case-insensitive partial match of this string with either the asset's name or description.
objectAttributesarray{
"limit":2,
"orderBy":"createdOn:asc",
"search":"1225",
"label":"bed",
"attributes":{
"EquipmentManufacturer":"Example Company"
},
"format":"long",
"offset":0
}
Response
- application/json
200 Response
objectQuery Results-
count(optional):
integer
Number of items in this response.
-
hasMore(optional):
boolean
`true` if there are more items to return.
-
items(optional):
array items
Minimum Number of Items:
1Assets found. -
limit(optional):
integer
Limit requested.
-
offset(optional):
integer
Offset (starting index) requested for this response.
-
totalResults(optional):
integer
Number of items that match the query.
array1-
Array of:
object Asset
Title:
AssetThe long format includes all properties. The short format contains only `id`, `name`, `description`, and `label`. The short format applies to `POST /mobile/platform/location/assets` responses only.
objectAsset-
attributes(optional):
object Attributes
Title:
AttributesAdditional Properties Allowed: additionalPropertiesThe attributes entered in the MCS UI, as key/value pairs. -
createdBy:
string
User who added the asset.
-
createdOn:
string
When the asset was added.
-
description:
string
Asset's description.
-
devices(optional):
array devices
Minimum Number of Items:
0Devices associated with this asset. Typically one device, but there can be multiple devices. -
id:
number
Asset's ID.
-
label(optional):
string
Asset's label.
-
lastKnownPlace(optional):
object Last Known Location
Title:
Last Known LocationLast known location of the asset. -
links:
array Relationship links
Title:
Relationship linksMinimum Number of Items:1Unique Items Required:true -
modifiedBy(optional):
string
User who last modified the asset.
-
modifiedOn(optional):
string
When the asset was last modified.
-
name:
string
User-defined name for the asset.
objectAttributesarray0-
Array of:
object Associated Location Device
Title:
Associated Location DeviceThe properties for an associated location device. Note that this object doesn't contain the `asset` and `place` properties.
objectLast Known LocationarrayRelationship links1true-
Array of:
object Link
Title:
Link
objectAssociated Location Device-
attributes(optional):
object Attributes
Title:
AttributesAdditional Properties Allowed: additionalPropertiesThe attributes entered in the MCS UI, as key/value pairs. -
beacon(optional):
object Beacon
Title:
BeaconDevice's identifying information. -
createdBy:
string
User who added the device.
-
createdOn:
string
When the device was added to MCS.
-
description:
string
Device's description.
-
id:
number
Device's ID.
-
links:
array Relationship links
Title:
Relationship linksMinimum Number of Items:1Unique Items Required:true -
modifiedBy(optional):
string
User who last modified the device.
-
modifiedOn(optional):
string
When the device was last modified.
-
name:
string
User-defined name for the device.
objectBeaconobject-
major(optional):
string
Device's major version number.
-
minor(optional):
string
Device's minor version number.
-
uuid(optional):
string
Device's UUID.
object-
id1(optional):
string
Device's first ID.
-
id2(optional):
string
Device's second ID.
-
id3(optional):
string
Device's third ID.
object-
eddystoneUid(optional):
object eddystoneUid
Device's UID.
-
eddystoneUrl(optional):
object eddystoneUrl
Device's URL.
object-
instance(optional):
string
Individual device's ID.
-
namespace(optional):
string
Namespace that the device is a member of.
object-
latitude(optional):
number
GPS point's latitude
-
longitude(optional):
number
GPS point's longitude.
objectLink-
href:
string
A relative URL.
-
rel:
Allowed Values:
[ "self", "canonical", "prev", "next" ]The type of link.
{
"limit":2,
"hasMore":true,
"count":2,
"items":[
{
"id":333,
"createdOn":"2015-08-06T18:37:59.424Z",
"modifiedOn":"2015-08-06T18:37:59.424Z",
"lastKnownLocation":{
"placeId":244
},
"createdBy":"jdoe",
"modifiedBy":"jdoe",
"description":"model 1225 hospital bed",
"name":"hospital bed #233",
"label":"hospital bed",
"links":[
{
"rel":"canonical",
"href":"/mobile/platform/location/assets/333"
},
{
"rel":"self",
"href":"/mobile/platform/location/assets/333"
}
],
"attributes":{
"SJId":"6754843090",
"EquipmentManufacturer":"Example Company"
},
"devices":[
{
"id":3401,
"createdOn":"2015-08-06T18:37:59.424Z",
"modifiedOn":"2015-08-08T07:22:44.654Z",
"createdBy":"jdoe",
"modifiedBy":"tsmith",
"description":"Beacon on 1st Floor in FixitFast Warehouse in Redwood City",
"name":"RC_WH_01_F01_B001",
"links":[
{
"rel":"canonical",
"href":"/mobile/platform/location/devices/3401"
},
{
"rel":"self",
"href":"/mobile/platform/location/devices/3401"
}
],
"beacon":{
"iBeacon":{
"minor":"1.1",
"uuid":"B9407F30-F5F8-466E-AFF9-25556B57FE6D",
"major":"1.0"
}
},
"attributes":{
"manufacturerId":"10D39AE7-020E-4467-9CB2-DD36366F899D",
"status":"Active",
"visibility":"Public",
"manufacturer":"Abc Company"
}
}
]
},
{
"id":888,
"createdOn":"2015-10-16T09:24:41.354Z",
"modifiedOn":"2015-10-16T09:24:41.354Z",
"lastKnownLocation":{
"placeId":360
},
"createdBy":"jdoe",
"modifiedBy":"jdoe",
"description":"model 1225 hospital bed",
"name":"hospital bed #233",
"label":"hospital bed",
"links":[
{
"rel":"canonical",
"href":"/mobile/platform/location/assets/888"
},
{
"rel":"self",
"href":"/mobile/platform/location/assets/888"
}
],
"attributes":{
"SJId":"6754843090",
"EquipmentManufacturer":"Example Company"
},
"devices":[
{
"id":648,
"createdOn":"2015-08-06T18:37:59.424Z",
"modifiedOn":"2015-08-08T07:22:44.654Z",
"createdBy":"jdoe",
"modifiedBy":"tsmith",
"description":"Beacon on 1st Floor in FixitFast Warehouse in Redwood City",
"name":"RC_WH_01_F01_B001",
"links":[
{
"rel":"canonical",
"href":"/mobile/platform/location/devices/648"
},
{
"rel":"self",
"href":"/mobile/platform/location/devices/648"
}
],
"beacon":{
"iBeacon":{
"minor":"1.1",
"uuid":"B9407F30-F5F8-466E-AFF9-25556B57FE6D",
"major":"1.0"
}
},
"attributes":{
"manufacturerId":"10D39AE7-020E-4467-9CB2-DD36366F899D",
"status":"Active",
"visibility":"Public",
"manufacturer":"Abc Company"
}
}
]
}
],
"totalResults":32,
"offset":0
}
400 Response
The request failed because the JSON payload for the query is not well-formed, or because an exception occurred during processing.
objectError-
detail:
string
Message that provides the error details.
-
o:ecid:
string
Execution context ID, which is a unique identifier to correlate events or requests that are associated with the same transaction across several components.
-
o:errorCode:
string
Mobile Cloud Service error code.
-
o:errorDetails(optional):
array o:errorDetails
Minimum Number of Items:
0List of the issues that cause the error. Included when the error is caused by multiple issues. -
o:errorPath:
string
The relative point in the API path where the error occurred.
-
status:
integer
HTTP status code. See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html for more details.
-
title:
string
Summary of the problem.
-
type:
string
The URI to the link that provides details about the HTTP status code.
array0-
Array of:
object Error Detail
Title:
Error Detail
objectError Detail-
instance:
string
The URI to the link that provides more detailed information about the error.
-
o:errorCode:
string
Mobile Cloud Service error code.
-
o:errorPath:
string
The relative point in the API path where the error occurred.
-
title:
string
Summary of the problem.
-
type:
string
The URI to the link that provides details about the HTTP status code.
Examples
This example shows how to use cURL to retrieve information about assets by submitting a POST request on the REST resource.
curl -i \
-X POST \
-u mobile.user@example.com:password \
-d @assets.json \
-H "Content-Type: application/json; charset=utf-8" \
-H "Oracle-Mobile-Backend-ID: ABCD9278-091f-41aa-9cb2-184bd0586fce" \
https://fif.cloud.oracle.com/mobile/platform/location/assets/query
Example of Request Body
Here's an example of the request body in JSON format. This example requests, in ascendingcreatedOn order, information about assets where the label includes the string bed, the EquipmentManufacturer attribute is Example Company, and either the name or description contains the string 1225 (case-insensitive matches). This request asks for the first two search results. If you subsequently want to get the next set of assets, starting with the third asset, you would send another request with the offset set to 2. Note that it is requesting the long format of the response body. If the value was short, then the response body would include id, name, description, and label only.
{
"label":"bed",
"attributes":{
"EquipmentManufacturer":"Example Company"
},
"orderBy":"createdOn:asc",
"offset":0,
"limit":2,
"format":"long",
"search":"1225"
}
Example of Response Header
Here's an example of the response header:
200 OK
Content-Length: 1081
Content-Type: application/json
Date: Tue, 16 Jun 2015 01:39:07 GMT
Example of Response Body
This example shows the contents of the response body in JSON format:
{
"items":[
{
"devices":[
{
"id":3401,
"createdBy":"jdoe",
"name":"RC_WH_01_F01_B001",
"createdOn":"2015-08-06T18:37:59.424Z",
"modifiedOn":"2015-08-08T07:22:44.654Z",
"beacon":{
"iBeacon":{
"uuid":"B9407F30-F5F8-466E-AFF9-25556B57FE6D",
"major":"1.0",
"minor":"1.1"}},
"modifiedBy":"tsmith",
"links":[
{
"rel":"canonical",
"href":"/mobile/platform/location/devices/3401"},
{
"rel":"self",
"href":"/mobile/platform/location/devices/3401"}
],
"attributes":{
"manufacturer":"Example Company",
"manufacturerId":"10D39AE7-020E-4467-9CB2-DD36366F899D",
"status":"Active",
"visibility":"Public"},
"description":"Beacon on 1st Floor in FixitFast Warehouse in Redwood City"}
],
"label":"hospital bed",
"lastKnownLocation":{
"placeId":244},
"id":333,
"createdBy":"jdoe",
"name":"hospital bed #233",
"createdOn":"2015-08-06T18:37:59.424Z",
"modifiedOn":"2015-08-06T18:37:59.424Z",
"modifiedBy":"jdoe",
"links":[
{
"rel":"canonical",
"href":"/mobile/platform/location/assets/333"},
{
"rel":"self",
"href":"/mobile/platform/location/assets/333"}
],
"attributes":{
"EquipmentManufacturer":"Example Company",
"SJId":"6754843090"},
"description":"model 1225 hospital bed"},
{
"devices":[
{
"id":648,
"createdBy":"jdoe",
"name":"RC_WH_01_F01_B001",
"createdOn":"2015-08-06T18:37:59.424Z",
"modifiedOn":"2015-08-08T07:22:44.654Z",
"beacon":{
"iBeacon":{
"uuid":"B9407F30-F5F8-466E-AFF9-25556B57FE6D",
"major":"1.0",
"minor":"1.1"}},
"modifiedBy":"tsmith",
"links":[
{
"rel":"canonical",
"href":"/mobile/platform/location/devices/648"},
{
"rel":"self",
"href":"/mobile/platform/location/devices/648"}
],
"attributes":{
"manufacturer":"Example Company",
"manufacturerId":"10D39AE7-020E-4467-9CB2-DD36366F899D",
"status":"Active",
"visibility":"Public"},
"description":"Beacon on 1st Floor in FixitFast Warehouse in Redwood City"}
],
"label":"hospital bed",
"lastKnownLocation":{
"placeId":360},
"id":888,
"createdBy":"jdoe",
"name":"hospital bed #233",
"createdOn":"2015-10-16T09:24:41.354Z",
"modifiedOn":"2015-10-16T09:24:41.354Z",
"modifiedBy":"jdoe",
"links":[
{
"rel":"canonical",
"href":"/mobile/platform/location/assets/888"},
{
"rel":"self",
"href":"/mobile/platform/location/assets/888"}
],
"attributes":{
"EquipmentManufacturer":"Example Company",
"SJId":"6754843090"},
"description":"model 1225 hospital bed"}
],
"totalResults":32,
"offset":0,
"limit":2,
"count":2,
"hasMore":true
}