Return Places by Query

post

/mobile/platform/location/places/query

Call this operation to retrieve the places and, optionally, the associated devices that match the query properties 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

Supported Media Types
Body ()
Root Schema : Query Parameters
Type: object
Title: Query Parameters
Show Source
Nested Schema : Attributes
Type: object
Title: Attributes
Additional Properties Allowed
Show Source
The attributes entered in the MCS UI, as key/value pairs.
Show Source
Nested Schema : gpsCircle
Type: object
GPS circle.
Show Source
Nested Schema : listOfPlaces
Type: array
Place ID(s) to search for. For example `[15,16]`.
Show Source
Nested Schema : gpsPoint
Type: object
GPS point.
Show Source
Example Request (application/json)
{
    "limit":2,
    "orderBy":"name:asc",
    "format":"long",
    "offset":0,
    "inGeoFence":{
        "gpsCircle":{
            "longitude":122.262,
            "radius":180000,
            "latitude":37.4996
        }
    }
}
Back to Top

Response

Supported Media Types

200 Response

The places that matched the query parameters were retrieved successfully.
Body ()
Root Schema : Query Results
Type: object
Title: Query Results
Show Source
Nested Schema : items
Type: array
Minimum Number of Items: 1
Places found.
Show Source
  • Place
    Title: Place
    The long format includes all properties. The short format contains only `id`, `name`, `description`, `children`, and `label`. The short format applies to `POST /mobile/platform/location/places` responses only.
Nested Schema : Place
Type: object
Title: Place
The long format includes all properties. The short format contains only `id`, `name`, `description`, `children`, and `label`. The short format applies to `POST /mobile/platform/location/places` responses only.
Show Source
Nested Schema : Place's Address
Type: object
Title: Place's Address
GPS address of the place.
Match One
Show Source
Nested Schema : Attributes
Type: object
Title: Attributes
Additional Properties Allowed
Show Source
The attributes entered in the MCS UI, as key/value pairs.
Show Source
Nested Schema : children
Type: array
Minimum Number of Items: 0
Places that are the child places of this place. This includes the full hierarchy of places that descend from this place.
Show Source
  • Place
    Title: Place
    The long format includes all properties. The short format contains only `id`, `name`, `description`, `children`, and `label`. The short format applies to `POST /mobile/platform/location/places` responses only.
Nested Schema : descendantDevices
Type: array
Minimum Number of Items: 0
Devices that are associated with this place and all its child places. This property is included in query results when the `descendantDevices` query parameter is set to `true`. All devices found are included in short form only.
Show Source
  • Location Device
    Title: Location Device
    The properties for a location device. The long format includes all properties. The short format applies to `POST /mobile/platform/location/devices` responses only.
Nested Schema : devices
Type: array
Minimum Number of Items: 0
Devices associated with this asset. Typically one device, but there can be multiple devices.
Show Source
Nested Schema : gpsPoint
Type: object
GPS point.
Show Source
Nested Schema : gpsCircle
Type: object
GPS circle.
Show Source
Nested Schema : gpsPolygon
Type: object
GPS polygon.
Show Source
Nested Schema : vertices
Type: array
Minimum Number of Items: 1
GPS polygon's vertices.
Show Source
Nested Schema : latitudeLongitudePair
Type: object
Pair of latitude and longitude values for a place.
Show Source
Nested Schema : Location Device
Type: object
Title: Location Device
The properties for a location device. The long format includes all properties. The short format applies to `POST /mobile/platform/location/devices` responses only.
Show Source
Nested Schema : Associated Asset
Type: object
Title: Associated Asset
The properties for an associated asset. This object doesn't include the `devices` property because the associated device is the containing object.
Show Source
Nested Schema : Beacon
Type: object
Title: Beacon
Device's identifying information.
Match One
Show Source
Nested Schema : Associated Place
Type: object
Title: Associated Place
The properties for an associated place. This object doesn't include the `devices` property because the associated device is the containing object.
Show Source
Nested Schema : Last Known Location
Type: object
Title: Last Known Location
Last known location of the asset.
Match One
Show Source
Nested Schema : iBeacon
Type: object
iBeacon device.
Show Source
Nested Schema : altBeacon
Type: object
AltBeacon device.
Show Source
Nested Schema : eddystone
Type: object
Eddystone device.
Show Source
Nested Schema : eddystoneUid
Type: object
Device's UID.
Show Source
Nested Schema : eddystoneUrl
Type: object
Device's URL.
Show Source
Nested Schema : Associated Location Device
Type: object
Title: Associated Location Device
The properties for an associated location device. Note that this object doesn't contain the `asset` and `place` properties.
Show Source
Example Response (application/json)
{
    "limit":2,
    "hasMore":true,
    "count":2,
    "items":[
        {
            "createdOn":"2015-08-06T18:37:59.424Z",
            "id":112,
            "modifiedOn":"2015-08-06T18:37:59.424Z",
            "hasChildren":false,
            "createdBy":"jdoe",
            "address":{
                "gpsPoint":{
                    "longitude":37,
                    "latitude":122
                }
            },
            "description":"FixItFast Warehouse in Redwood City",
            "modifiedBy":"jdoe",
            "name":"FixItFast Redwood City Warehouse",
            "links":[
                {
                    "rel":"canonical",
                    "href":"/mobile/platform/location/places/112"
                },
                {
                    "rel":"self",
                    "href":"/mobile/platform/location/places/112"
                }
            ],
            "label":"FixItFast Warehouse",
            "attributes":{
                "hours":"9am-6pm"
            },
            "devices":[
                {
                    "id":12345,
                    "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/12345"
                        },
                        {
                            "rel":"self",
                            "href":"/mobile/platform/location/devices/12345"
                        }
                    ],
                    "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"
                    }
                }
            ],
            "parentPlace":42
        },
        {
            "createdOn":"2015-08-06T19:27:59.424Z",
            "id":325,
            "modifiedOn":"2015-08-06T19:27:59.424Z",
            "hasChildren":false,
            "createdBy":"jdoe",
            "address":{
                "gpsCircle":{
                    "longitude":37,
                    "radius":300,
                    "latitude":123
                }
            },
            "description":"FixItFast Warehouse in Palo Alto",
            "modifiedBy":"jdoe",
            "name":"FixItFast Palo Alto Warehouse",
            "links":[
                {
                    "rel":"canonical",
                    "href":"/mobile/platform/location/places/325"
                },
                {
                    "rel":"self",
                    "href":"/mobile/platform/location/places/325"
                }
            ],
            "label":"FixItFast Warehouse",
            "attributes":{
                "hours":"9am-6pm"
            },
            "devices":[
                {
                    "id":111,
                    "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/111"
                        },
                        {
                            "rel":"self",
                            "href":"/mobile/platform/location/devices/111"
                        }
                    ],
                    "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":222,
                    "createdOn":"2015-08-08T18:37:59.424Z",
                    "modifiedOn":"2015-08-12T07:22:44.654Z",
                    "createdBy":"jdoe",
                    "modifiedBy":"tsmith",
                    "description":"Beacon on 2nd Floor in FixitFast Warehouse in Redwood City",
                    "name":"RC_WH_01_F01_B996",
                    "links":[
                        {
                            "rel":"canonical",
                            "href":"/mobile/platform/location/devices/222"
                        },
                        {
                            "rel":"self",
                            "href":"/mobile/platform/location/devices/222"
                        }
                    ],
                    "beacon":{
                        "iBeacon":{
                            "minor":"1.1",
                            "uuid":"B9407F30-F5F8-466E-AFF9-25552345908234DD0",
                            "major":"1.0"
                        }
                    },
                    "attributes":{
                        "manufacturerId":"10D39AE7-020E-4467-9CB2-DD36366F899D",
                        "status":"Active",
                        "visibility":"Public",
                        "manufacturer":"Abc Company"
                    }
                }
            ],
            "parentPlace":42
        }
    ],
    "totalResults":203,
    "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.

Body ()
Root Schema : Error
Type: object
Title: Error
The error JSON object returned by Mobile Cloud Service.
Show Source
Nested Schema : o:errorDetails
Type: array
Minimum Number of Items: 0
List of the issues that cause the error. Included when the error is caused by multiple issues.
Show Source
Nested Schema : Error Detail
Type: object
Title: Error Detail
Show Source
Back to Top

Examples

This example shows how to use cURL to retrieve information about places by submitting a POST request on the REST resource.

curl -i \
-X POST \ 
-u mobile.user@example.com:password \
-d @places.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/places/query

Example of Request Body

Here's an example of the request body in JSON format. This example requests, in ascending name order, information about all the places where the label includes the string block (case-insensitive match) and that are in a defined circle with the specified radius where the center is at the given latitude and longitude. This request asks for the first 2 search results. If you subsequently want to get the next set of places, starting with the 3rd place, you would send another request with the offset set to 2. Note that, by default, it's requesting both root and child places, and it's requesting the long format of the response body.

{ "label":"block",
  "inGeoFence":{
    "gpsCircle":{
      "longitude":-120.8745,
      "latitude":37.9856,
      "radius":180000
    }
  },
  "orderBy":"name:asc",
  "offset":0,
  "limit":2
}

Example of Response Header

Here's an example of the response header:

200 OK
Content-Type: application/json
Date: Thu, 19 Apr 2018 22:15:15 GMT

Example of Response Body

This example shows the contents of the response body in JSON format, which is an array of the matching items. Note that by default, it shows all parent and child places.

{
    "items": [
        {
            "id": 10,
            "createdOn": "2018-04-19T21:42:07.506Z",
            "createdBy": "mobile.user@example.com",
            "modifiedOn": "2018-04-19T21:42:07.506Z",
            "modifiedBy": "mobile.user@example.com",
            "name": "l1b1",
            "label": "lot 1 block 1",
            "description": "Lot 1 block 1 New City",
            "hasChildren": true,
            "address": {
                "gpsCircle": {
                    "longitude": -120.8745,
                    "latitude": 37.9856,
                    "radius": 29999.99999998
                }
            },
            "attributes": {
                "acres": ".25"
            },
            "links": [
                {
                    "rel": "canonical",
                    "href": "/mobile/platform/location/places/10"
                },
                {
                    "rel": "self",
                    "href": "/mobile/platform/location/places/10"
                }
            ],
            "children": [
                {
                    "id": 12,
                    "createdOn": "2018-04-19T21:51:06.772Z",
                    "createdBy": "mobile.user@example.com",
                    "modifiedOn": "2018-04-19T21:51:06.772Z",
                    "modifiedBy": "mobile.user@example.com",
                    "name": "s1l1b1",
                    "label": "sublot 1 lot 1 block 1",
                    "parentPlace": 10,
                    "description": "Sublot 1 Lot 1 block 1 New City",
                    "hasChildren": true,
                    "address": {
                        "gpsCircle": {
                            "longitude": -120.8745,
                            "latitude": 37.9856,
                            "radius": 29999.99999998
                        }
                    },
                    "attributes": {
                        "acres": ".1"
                    },
                    "links": [
                        {
                            "rel": "canonical",
                            "href": "/mobile/platform/location/places/12"
                        },
                        {
                            "rel": "self",
                            "href": "/mobile/platform/location/places/12"
                        }
                    ],
                    "children": [
                        {
                            "id": 13,
                            "createdOn": "2018-04-19T21:53:20.548Z",
                            "createdBy": "mobile.user@example.com",
                            "modifiedOn": "2018-04-19T21:53:20.548Z",
                            "modifiedBy": "mobile.user@example.com",
                            "name": "s2l1b1",
                            "label": "sublot 2 lot 1 block 1",
                            "parentPlace": 12,
                            "description": "Sublot 2 Lot 1 block 1 New City",
                            "hasChildren": false,
                            "address": {
                                "gpsCircle": {
                                    "longitude": -120.8745,
                                    "latitude": 37.9856,
                                    "radius": 29999.99999998
                                }
                            },
                            "attributes": {
                                "acres": ".1"
                            },
                            "links": [
                                {
                                    "rel": "canonical",
                                    "href": "/mobile/platform/location/places/13"
                                },
                                {
                                    "rel": "self",
                                    "href": "/mobile/platform/location/places/13"
                                }
                            ],
                            "children": []
                        }
                    ]
                }
            ]
        },
        {
            "id": 11,
            "createdOn": "2018-04-19T21:42:07.529Z",
            "createdBy": "mobile.user@example.com",
            "modifiedOn": "2018-04-19T21:42:07.529Z",
            "modifiedBy": "mobile.user@example.com",
            "name": "l2b1",
            "label": "lot2 block 1",
            "description": "Lot 2 block 1 New City",
            "hasChildren": false,
            "address": {
                "gpsPolygon": {
                    "vertices": [
                        {
                            "longitude": -121.7845,
                            "latitude": 37.8453
                        },
                        {
                            "longitude": -120.9853,
                            "latitude": 37.1248
                        },
                        {
                            "longitude": -121.7758,
                            "latitude": 37.6983
                        }
                    ]
                }
            },
            "attributes": {
                "acres": ".25"
            },
            "links": [
                {
                    "rel": "canonical",
                    "href": "/mobile/platform/location/places/11"
                },
                {
                    "rel": "self",
                    "href": "/mobile/platform/location/places/11"
                }
            ],
            "children": []
        }
    ],
    "totalResults": 4,
    "offset": 0,
    "limit": 2,
    "count": 2,
    "hasMore": true
}

Here's an example of the response body when the request body includes "format": "short". The response body includes id, name, description, and children only.

{
    "items": [
        {
            "id": 10,
            "name": "l1b1",
            "description": "Lot 1 block 1 New City",
            "label": "lot 1 block 1",
            "children": [
                {
                    "id": 12,
                    "name": "s1l1b1",
                    "description": "Sublot 1 Lot 1 block 1 New City",
                    "label": "sublot 1 lot 1 block 1",
                    "children": [
                        {
                            "id": 13,
                            "name": "s2l1b1",
                            "description": "Sublot 2 Lot 1 block 1 New City",
                            "label": "sublot 2 lot 1 block 1",
                            "children": []
                        }
                    ]
                }
            ]
        },
        {
            "id": 11,
            "name": "l2b1",
            "description": "Lot 2 block 1 New City",
            "label": "lot2 block 1",
            "children": []
        }
    ],
    "totalResults": 4,
    "offset": 0,
    "limit": 2,
    "count": 2,
    "hasMore": true
}
Back to Top