Location

Ask tech team
From QuickBlox Developers (API docs, code samples, SDK)
Jump to: navigation, search

Contents

Summary

This module is a hub connecting your app users over a Google Map. It stores GPS locations and other data and allows users to literally ‘see’ each other on the map and engage with other local users and objects.

  • Stores locations, online/offline flags, status messages for each user;
  • Allows easily calculation of distance (‘miles away’) and shows directions to users and objects;
  • Stores history of locations and movements (can also be used in corporate apps for tracking transport, etc);
  • Supports POIs (buildings, attractions, places of events, check-in places);
  • Manages users, POIs and stats via web-based admin panel of the module.

Need to know information

Before using Location module please read the following:

Location API

Requests and Responses

URL HTTP Verb Supported formats Action Description Success HTTP Status Code
/geodata POST
  • xml
  • json
Create geodata 201
/geodata/{geo_data_id} PUT
  • xml
  • json
Update geodata 200
/geodata/{geo_data_id} GET
  • xml
  • json
Retrieve geodata by the identifier 200
/geodata/find GET
  • xml
  • json
Retrieve geodata 200
/geodata/{geo_data_id} DELETE
  • xml
  • json
Delete geodata by the identifier 200
/geodata DELETE
  • xml
  • json
Delete geodata 200
/places POST
  • xml
  • json
Create place 201
/places GET
  • xml
  • json
Retrieve places 200
/places/{place_id} GET
  • xml
  • json
Retrieve place by identifier 200
/places/{place_id} PUT
  • xml
  • json
Update place by identifier 200
/places/{place_id} DELETE
  • xml
  • json
Delete place by identifier 200


Create geodata

Create geodata which represent points on the earth

Parameters
Param Required Type Value Example Description
geo_data[latitude] Yes GeoCoord 51.523284 Latitude
geo_data[longitude] Yes GeoCoord -0.111361 Longitude
geo_data[status] No String. Min length: 1. Max length: 1000 Hello world Status
Request
curl -X POST \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: fef1be67941e43d654987d21cd50a15fe28113f8" \
-d "geo_data[latitude]=33&geo_data[longitude]=44" \
http://api.quickblox.com/geodata.xml
curl -X POST \
-H "Content-Type: application/json" \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: fef1be67941e43d654987d21cd50a15fe28113f8" \
-d '{"geo_data": {"latitude": "33", "longitude": "44"}}' \
http://api.quickblox.com/geodata.json
curl -X POST \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: fef1be67941e43d654987d21cd50a15fe28113f8" \
-d "geo_data[latitude]=33&geo_data[longitude]=44&geo_data[status]= Great place" \
http://api.quickblox.com/geodata.xml
curl -X POST \
-H "Content-Type: application/json" \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: 20e55d804b6bff1cba87cb0215d8967150722ecb" \
-d '{"geo_data": {"latitude": "33", "longitude": "44", "status": "Hello"}}' \
http://api.quickblox.com/geodata.json
Response
<?xml version="1.0" encoding="UTF-8"?>
<geo-data>
  <application-id type='integer'>140</application-id>
  <created-at type='datetime'>2012-04-23T12:27:02Z</created-at>
  <id type='integer'>18437</id>
  <latitude type='decimal'>33.0</latitude>
  <longitude type='decimal'>44.0</longitude>
  <status nil='true'/>
  <updated-at type='datetime'>2012-04-23T12:27:02Z</updated-at>
  <user-id type='integer'>1326</user-id>
  <created-at-timestamp type='integer'>1335184022</created-at-timestamp>
</geo-data>
{
  "geo_data": {
    "application_id": 2,
    "created_at": "2012-03-26T13:11:59Z",
    "id": 101,
    "latitude": "33.0",
    "longitude": "44.0",
    "status": null,
    "updated_at": "2012-03-26T13:11:59Z",
    "user_id": 87,
    "created_at_timestamp": 1332767519
  }
}
<?xml version="1.0" encoding="UTF-8"?>
<geo-data>
  <application-id type='integer'>140</application-id>
  <created-at type='datetime'>2012-04-23T12:29:51Z</created-at>
  <id type='integer'>18439</id>
  <latitude type='decimal'>33.0</latitude>
  <longitude type='decimal'>44.0</longitude>
  <status>Great place</status>
  <updated-at type='datetime'>2012-04-23T12:29:51Z</updated-at>
  <user-id type='integer'>1326</user-id>
  <created-at-timestamp type='integer'>1335184191</created-at-timestamp>
</geo-data>
{
  "geo_data": {
    "application_id": 2,
    "created_at": "2012-03-22T11:04:16Z",
    "id": 76,
    "latitude": "33.0",
    "longitude": "44.0",
    "status": "Hello!",
    "updated_at": "2012-03-22T11:04:16Z",
    "user_id": 3,
    "created_at_timestamp": 1332414256
  }
}


Create geodata with the location-push

You can create or update geodata with sending a push notification to all users who is located in your radius.

Parameters
Param Required Type Value Example Description
geo_data[latitude] Yes GeoCoord 51.523284 Latitude
geo_data[longitude] Yes GeoCoord -0.111361 Longitude
geo_data[status] No String. Min length: 1. Max length: 1000 Hello world Status
geo_data[radius] Yes Unsigned Integer 60 The distance in meters around your coordinates
geo_data[push_message] Yes String Should be Base64 encoded text.
geo_data[push_environment] Yes Enum *development *production Environment of the notification
Request
curl -X POST \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: 2966e40870438154c5a9d9832ae563787f5d89b7" \
-d "geo_data[latitude]=50.1&geo_data[longitude]=50.2&geo_data[radius]=60&geo_data[push_message]=SGVsbG8=&geo_data[push_environment]=development" \
http://api.quickblox.com/geodata.xml
curl -X POST \
-H "Content-Type: application/json" \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: 2966e40870438154c5a9d9832ae563787f5d89b7" \
-d '{"geo_data": {"latitude": "50.1", "longitude": "50.2", "radius": "60", "push_message": "SGVsbG8=", "push_environment": "development"}}' \
http://api.quickblox.com/geodata.json
Response
<?xml version='1.0' encoding='UTF-8'?>
<geo-data>
  <application-id type='integer'>
    347
  </application-id>
  <created-at type='datetime'>
    2013-11-19T12:26:28Z
  </created-at>
  <id type='integer'>
    2187
  </id>
  <latitude type='decimal'>
    50.1
  </latitude>
  <longitude type='decimal'>
    50.2
  </longitude>
  <status nil='true'/>
  <updated-at type='datetime'>
    2013-11-19T12:26:28Z
  </updated-at>
  <user-id type='integer'>
    10695
  </user-id>
</geo-data>
{
  "geo_data": {
    "application_id": 347,
    "created_at": "2013-11-19T12:26:28Z",
    "id": 2187,
    "latitude": "50.1",
    "longitude": "50.2",
    "status": null,
    "updated_at": "2013-11-19T12:26:28Z",
    "user_id": 10695,
  }
}


Update geodata

Update geodata

Parameters
Param Type Value Example Description
geo_data[latitude] GeoCoord 51.523284 Latitude
geo_data[longitude] GeoCoord -0.111361 Longitude
geo_data[status] String. Min length: 1. Max length: 1000 Hello world Status
Request
curl -X PUT \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: fef1be67941e43d654987d21cd50a15fe28113f8" \
-d "geo_data[latitude]=25&geo_data[longitude]=33" \
http://api.quickblox.com/geodata/11300.xml
curl -X PUT \
-H "Content-Type: application/json" \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: 20e55d804b6bff1cba87cb0215d8967150722ecb" \
-d '{"geo_data": {"latitude": "33", "longitude": "44"}}' \
http://api.quickblox.com/geodata/101.json
Response
<?xml version="1.0" encoding="UTF-8"?>
<geo-data>
  <app-id type="integer">92</app-id>
  <created-at type="datetime">2012-01-13T14:03:41Z</created-at>
  <id type="integer">11300</id>
  <latitude type="decimal">25.0</latitude>
  <longitude type="decimal">33.0</longitude>
  <status nil="true"></status>
  <updated-at type="datetime">2012-01-13T14:02:41Z</updated-at>
  <user-id type="integer">292</user-id>
</geo-data>
{
  "geo_data": {
    "application_id": 2,
    "created_at": "2012-03-26T13:11:59Z",
    "id": 101,
    "latitude": "33.0",
    "longitude": "44.0",
    "status": null,
    "updated_at": "2012-03-26T13:14:59Z",
    "user_id": 87,
    "created_at_timestamp": 1332767519
  }
}


Retrieve geodata by the identifier

Request
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: 94a8a64512df282b5dbc73d066c105cbd3d6c039" \
http://api.quickblox.com/geodata/794.xml
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: 20e55d804b6bff1cba87cb0215d8967150722ecb" \
http://api.quickblox.com/geodata/794.json
Response
<?xml version='1.0' encoding='UTF-8'?>
<geo-data>
  <application-id type='integer'>111</application-id>
  <created-at type='datetime'>2012-06-11T15:11:08Z</created-at>
  <id type='integer'>794</id>
  <latitude type='decimal'>33.0</latitude>
  <longitude type='decimal'>44.0</longitude>
  <status nil='true'/>
  <updated-at type='datetime'>2012-06-11T15:11:08Z</updated-at>
  <user-id type='integer'>798</user-id>
  <created-at-timestamp type='integer'>1339427468</created-at-timestamp>
  <user>
    <blob-id type='integer' nil='true'/>
    <created-at type='datetime'>2012-05-10T09:41:19Z</created-at>
    <email>ivanko@domain.com</email>
    <external-user-id type='integer'>123456</external-user-id>
    <facebook-id>123456</facebook-id>
    <full-name>Tkach</full-name>
    <id type='integer'>798</id>
    <last-request-at type='datetime'>2012-06-14T09:32:16Z</last-request-at>
    <login>Ivan</login>
    <phone>123123</phone>
    <twitter-id>123456</twitter-id>
    <updated-at type='datetime'>2012-06-14T09:32:16Z</updated-at>
    <website>http://ivan.com</website>
    <user-tags>university, department</user-tags>
  </user>
</geo-data>
{
  "geo_data": {
    "application_id": 111,
    "created_at": "2012-06-11T15:11:08Z",
    "id": 794,
    "latitude": "33.0",
    "longitude": "44.0",
    "status": null,
    "updated_at": "2012-06-11T15:11:08Z",
    "user_id": 798,
    "created_at_timestamp": 1339427468,
    "user": {
      "user": {
        "id": 798,
        "full_name": "Tkach",
        "email": "ivanko@domain.com",
        "login": "Ivan",
        "phone": "123123",
        "website": "http://ivan.com",
        "created_at": "2012-05-10T09:41:19Z",
        "updated_at": "2012-06-14T09:32:16Z",
        "last_request_at": "2012-06-14T09:32:16Z",
        "external_user_id": 123456,
        "facebook_id": "123456",
        "twitter_id": "123456",
        "blob_id": null,
        "user_tags": "university, department"
      }
    }
  }
}


Retrieve geodata

Retrieve all (by default) geodata for current application. The ID of the application is taken from the token which is specified in the request

Filters

The request can contain all, some or none of these parameters. If this option is set, its value - the object to validate. Filters require an exact match property values ​​with an instance of the corresponding parameter value.

Param Required Type Value Example Description
created_at No Timestamp 1326471371 Time of created instance of geodata. When specified, it will return only instances created at 'created_at' time, or none - in which case it returns an empty array.
user.id No Integer 322 User id. When specified, it will return only the instances created by API User with id = user.id, or none - in which case it returns an empty array.
user.ids No Integer 322,23,5 Users' IDs. When specified, it return only the instances created by API Users with ids = user.ids, or none - in which case it returns an empty array.
user.name No String flo Substring. Search for API Users full_name and login fields. When specified, it will return only the instances created by API Users who have in login or full_name passed substring, or none - in which case it returns an empty array.
user.external_ids No Integer 132,45,577 External user IDs. When specified, it return only the instances created by API Users with external_ids = user.external_ids, or none - in which case it returns an empty array.


Diapasons

The request can contain all, some or none of these parameters. If this option is set, its value - the object to validate. Ranges suggest putting into the range of values ​​of the properties of the instance.

Param Required Type Value Example Description
min_created_at No Unix timestamp 1326471371 Min value of created_at. If this parameter is specified, must return instances with created_at greater than or equal to a given value.
max_created_at No Unix timestamp 1196473372 Max value of created_at. If this parameter is specified, must return instances with created_at less than or equal to a given value.
geo_rect No GeoRect 47%3B55%3B-103%3B54 GeoRect. If this parameter is correct, must return instances with coordinates that fall within the rectangle and its border. You need two points to build a rectangle (first point -- South West, second -- North East). Coordinates, specified in the request, should be in this order: latitude1;longitude1;latitude2;longitude2. Use '%3B' instead ';'.
radius No Unsigned Integer 15 With 'current_position' describes GeoCircle - "circle" on the earth's surface, given the coordinates 'current_position' and this distance in kilometres (radius).


Sort

In the query as the value of sorting can be any of these parameters or nothing. The presence of other parameters ​​- validation error.
Parameter name: sort_by.
Sort Order: Descending, if missing parameter 'sort_asc'.

Param Required Type Value Example Description
created_at No Integer 1 (all other values ​​cause an error validation) Values ​​should be sorted by date.
latitude No Integer 1 (all other values ​​cause an error validation) Values ​​should be sorted by latitude.
longitude No Integer 1 (all other values ​​cause an error validation) Values ​​should be sorted by longitude.
distance No Integer 1 (all other values ​​cause an error validation) Values ​​should be sorted by the distance from the 'current_position' (is a required parameter in the request)


Paginal conclusion

The request can contain all, some or none of these parameters.

Param Required Type Value Example Description
page No Unsigned Integer 3 Page number of the book of the results that you want to get. By default: 1
per_page No Unsigned Integer 15 The maximum number of results per page. Min: 1. Max: 100. By default: 10


Additional keys

Used for special features.

Param Required Type Value Example Description
last_only No Integer 1 (all other values ​​cause an error validation) The result will only include the last time data. For example, if the query is filtered by user.id parameter and flag last_only is set, we get an instance - the most recent by created_at for this user, its last known position.
status No Integer 1 (all other values ​​cause an error validation) The result will only include instances that have a non-empty 'status' field.
current_position No GeoPoint 1%3B2 The current position of the user. Used only in conjunction with the keys 'radius' (Diapasons) and 'distance' (Sort). If this option is specified, and it does not set any of these parameters - error validation. Use '%3B' instead ';'.
sort_asc No Integer 1 (all other values ​​as well as the presence of this key parameter without 'sort_by' ​​cause an error validation) Indicates that the sorting should be by ascending. If this parameter is not set - the sort is by descending.


Request
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: 2dc56114e2a5c5d094efe3f1187dd60b9a241152" \
http://api.quickblox.com/geodata/find.xml
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: 2dc56114e2a5c5d094efe3f1187dd60b9a241152" \
http://api.quickblox.com/geodata/find.json
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: 2dc56114e2a5c5d094efe3f1187dd60b9a241152" \
http://api.quickblox.com/geodata/find.xml?created_at=1326702775
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: cc3598167f68a8e95b50a4fc6607cd3a8e7f043b" \
http://api.quickblox.com/geodata/find.json?created_at=1326702614
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: cc3598167f68a8e95b50a4fc6607cd3a8e7f043b" \
http://api.quickblox.com/geodata/find.xml?user.id=3
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: cc3598167f68a8e95b50a4fc6607cd3a8e7f043b" \
http://api.quickblox.com/geodata/find.json?user.id=87
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: cc3598167f68a8e95b50a4fc6607cd3a8e7f043b" \
http://api.quickblox.com/geodata/find.xml?user.ids=3,4,87
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: cc3598167f68a8e95b50a4fc6607cd3a8e7f043b" \
http://api.quickblox.com/geodata/find.json?user.ids=3,4,87
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: cc3598167f68a8e95b50a4fc6607cd3a8e7f043b" \
http://api.quickblox.com/geodata/find.xml?user.name=Cookie
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: cc3598167f68a8e95b50a4fc6607cd3a8e7f043b" \
http://api.quickblox.com/geodata/find.json?user.name=injoit
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: cc3598167f68a8e95b50a4fc6607cd3a8e7f043b" \
http://api.quickblox.com/geodata/find.xml?user.external_ids=3,4,87
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: cc3598167f68a8e95b50a4fc6607cd3a8e7f043b" \
http://api.quickblox.com/geodata/find.json?user.external_ids=3,4,87
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: cc3598167f68a8e95b50a4fc6607cd3a8e7f043b" \
http://api.quickblox.com/geodata/find.xml?min_created_at=1326702614
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: cc3598167f68a8e95b50a4fc6607cd3a8e7f043b" \
http://api.quickblox.com/geodata/find.json?min_created_at=1326702614
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: cc3598167f68a8e95b50a4fc6607cd3a8e7f043b" \
http://api.quickblox.com/geodata/find.xml?max_created_at=1326702614
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: cc3598167f68a8e95b50a4fc6607cd3a8e7f043b" \
http://api.quickblox.com/geodata/find.json?max_created_at=1326702771
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: cc3598167f68a8e95b50a4fc6607cd3a8e7f043b" \
http://api.quickblox.com/geodata/find.xml?geo_rect=47%3B55%3B-103%3B54
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: cc3598167f68a8e95b50a4fc6607cd3a8e7f043b" \
http://api.quickblox.com/geodata/find.json?geo_rect=47%3B55%3B-103%3B54
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: cc3598167f68a8e95b50a4fc6607cd3a8e7f043b" \
http://api.quickblox.com/geodata/find.xml?radius=3000&current_position=90%3B90
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: cc3598167f68a8e95b50a4fc6607cd3a8e7f043b" \
http://api.quickblox.com/geodata/find.json?radius=3000&current_position=45%3B45
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: cc3598167f68a8e95b50a4fc6607cd3a8e7f043b" \
http://api.quickblox.com/geodata/find.xml?sort_by=created_at
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: cc3598167f68a8e95b50a4fc6607cd3a8e7f043b" \
http://api.quickblox.com/geodata/find.json?sort_by=created_at
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: cc3598167f68a8e95b50a4fc6607cd3a8e7f043b" \
http://api.quickblox.com/geodata/find.xml?sort_by=latitude
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: cc3598167f68a8e95b50a4fc6607cd3a8e7f043b" \
http://api.quickblox.com/geodata/find.json?sort_by=latitude
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: cc3598167f68a8e95b50a4fc6607cd3a8e7f043b" \
http://api.quickblox.com/geodata/find.xml?sort_by=longitude
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: cc3598167f68a8e95b50a4fc6607cd3a8e7f043b" \
http://api.quickblox.com/geodata/find.json?sort_by=longitude
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: cc3598167f68a8e95b50a4fc6607cd3a8e7f043b" \
http://api.quickblox.com/geodata/find.xml?sort_by=distance&current_position=1%3B2
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: cc3598167f68a8e95b50a4fc6607cd3a8e7f043b" \
http://api.quickblox.com/geodata/find.json?sort_by=distance&current_position=1%3B2
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: cc3598167f68a8e95b50a4fc6607cd3a8e7f043b" \
http://api.quickblox.com/geodata/find.xml?page=1&per_page=3
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: cc3598167f68a8e95b50a4fc6607cd3a8e7f043b" \
http://api.quickblox.com/geodata/find.json?page=1&per_page=3
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: cc3598167f68a8e95b50a4fc6607cd3a8e7f043b" \
http://api.quickblox.com/geodata/find.xml?last_only=1
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: cc3598167f68a8e95b50a4fc6607cd3a8e7f043b" \
http://api.quickblox.com/geodata/find.json?last_only=1
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: cc3598167f68a8e95b50a4fc6607cd3a8e7f043b" \
http://api.quickblox.com/geodata/find.xml?status=1
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: cc3598167f68a8e95b50a4fc6607cd3a8e7f043b" \
http://api.quickblox.com/geodata/find.json?status=1
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: cc3598167f68a8e95b50a4fc6607cd3a8e7f043b" \
http://api.quickblox.com/geodata/find.xml?sort_by=distance&current_position=1%3B2
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: cc3598167f68a8e95b50a4fc6607cd3a8e7f043b" \
http://api.quickblox.com/geodata/find.json?sort_by=distance&current_position=1%3B2
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: cc3598167f68a8e95b50a4fc6607cd3a8e7f043b" \
http://api.quickblox.com/geodata/find.xml?sort_by=longitude&sort_asc=1
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: cc3598167f68a8e95b50a4fc6607cd3a8e7f043b" \
http://api.quickblox.com/geodata/find.json?sort_by=longitude&sort_asc=1


Response
<?xml version='1.0' encoding='UTF-8'?>
<geo-data type='array' current_page='1' per_page='10' total_entries='13'>
  <geo-datum>
    <application-id type='integer'>2</application-id>
    <created-at type='datetime'>2012-05-08T09:54:41Z</created-at>
    <id type='integer'>315</id>
    <latitude type='decimal'>50.0</latitude>
    <longitude type='decimal'>50.0</longitude>
    <status nil='true'/>
    <updated-at type='datetime'>2012-05-08T09:54:41Z</updated-at>
    <user-id type='integer'>87</user-id>
    <created-at-timestamp type='integer'>1336470881</created-at-timestamp>
    <user>
      <blob-id type='integer' nil='true'/>
      <created-at type='datetime'>2012-03-20T08:47:34Z</created-at>
      <email>john@domain.com</email>
      <external-user-id type='integer'>158</external-user-id>
      <facebook-id>1346987743</facebook-id>
      <full-name>John Partizan</full-name>
      <id type='integer'>87</id>
      <last-request-at type='datetime'>2012-05-10T09:21:19Z</last-request-at>
      <login>Kitty</login>
      <owner-id type='integer'>4</owner-id>
      <phone>7665891</phone>
      <twitter-id>545878645453</twitter-id>
      <updated-at type='datetime'>2012-05-10T09:21:19Z</updated-at>
      <website>http://partizan.com</website>
      <user-tags>hello, world, hey</user-tags>
    </user>
  </geo-datum>
    ...
</geo-data>
{
  "current_page": 1,
  "per_page": 10,
  "total_entries": 4,
  "items": [
    {
      "geo_datum": {
        "application_id": 2,
        "created_at": "2012-05-08T09:54:41Z",
        "id": 315,
        "latitude": "50.0",
        "longitude": "50.0",
        "status": null,
        "updated_at": "2012-05-08T09:54:41Z",
        "user_id": 87,
        "created_at_timestamp": 1336470881,
        "user": {
          "user": {
            "id": 87,
            "owner_id": 4,
            "full_name": "John Partizan",
            "email": "john@domain.com",
            "login": "Kitty",
            "phone": "7665891",
            "website": "http://partizan.com",
            "created_at": "2012-03-20T08:47:34Z",
            "updated_at": "2012-05-10T09:21:19Z",
            "last_request_at": "2012-05-10T09:21:19Z",
            "external_user_id": 158,
            "facebook_id": "1346987743",
            "twitter_id": "545878645453",
            "blob_id": null,
            "user_tags": "hello, world, hey"
          }
        }
      }
    },
  ...
  ]
}


Delete geodata by the identifier

Delete geodatum

Request
curl -X DELETE \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: fef1be67941e43d654987d21cd50a15fe28113f8" \
http://api.quickblox.com/geodata/11300.xml
curl -X DELETE \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: fef1be67941e43d654987d21cd50a15fe28113f8" \
http://api.quickblox.com/geodata/11301.json
Response
Empty body, status: 200
Status: 200, null


Delete geodata

Cleanup of obsolete records

Parameters
Param Required Type Value Example Description
days Yes Integer 3 Maximum age of data that should remain in the database after a query.
Request
curl -X DELETE 
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: b5a8ee7356a8aa35178ce694a24c8d583c267ed2" \
http://api.quickblox.com/geodata.xml?days=34
curl -X DELETE \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: 20e55d804b6bff1cba87cb0215d8967150722ecb" \
http://api.quickblox.com/geodata.json?days=34
Response
Empty body, status: 200
Status: 200, null


Create place

The request can contain all, some or none of the optional parameters. Can create only the one place for the one 'geo_data_id'. If you create a place with a photo you should firstly create a blob, upload it and declaring file uploaded.

Parameters
Param Required Type Value Example Description
place[photo_id] No Unsigned Integer 45 ID of file representing a photo of the place(Content module)
place[geo_data_id] Yes Unsigned Integer 5 ID of geo_data with coordinates of the place
place[title] Yes String My place Place title
place[description] No String Kharkov place Place description
place[address] No String Lenina str, 45 Place address


Request
curl -X POST \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: b5a8ee7356a8aa35178ce694a24c8d583c267ed2" \
-d "place[title]=MyPlace&place[geo_data_id]=34&place[photo_id]=2" \
http://api.quickblox.com/places.xml
curl -X POST \
-H "Content-Type: application/json" \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: 20e55d804b6bff1cba87cb0215d8967150722ecb" \
-d '{"place": {"title": "Museum", "geo_data_id": "77", "photo_id": "85"}}' \
http://api.quickblox.com/places.json
Response
<?xml version="1.0" encoding="UTF-8"?>
<place>
  <address nil="true"></address>
  <created-at type="datetime">2012-03-20T10:26:07Z</created-at>
  <description nil="true"></description>
  <geo-data-id type="integer">34</geo-data-id>
  <id type="integer">54</id>
  <photo-id type="integer">2</photo-id>
  <title>MyPlace</title>
  <updated-at type="datetime">2012-03-20T10:29:13Z</updated-at>
  <latitude type="decimal">50.0</latitude>
  <longitude type="decimal">36.0</longitude>
</place>
{
  "place": {
    "address": null,
    "created_at": "2012-03-22T15:20:15Z",
    "description": null,
    "geo_data_id": 77,
    "id": 71,
    "photo_id": 85,
    "title": "Museum",
    "updated_at": "2012-03-22T15:20:15Z",
    "latitude": "33.0",
    "longitude": "44.0"
  }
}


Retrieve places

Retrieving a list of the created places by application. Application id is taken from the authorization token specified in the request

Request
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: d8ce187252586113e2c7f470abb48c94754a208f" \
http://api.quickblox.com/places.xml
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: c2ddcb6c3f61ca2ff6a6e69c09540e9b55e30302" \
http://api.quickblox.com/places.json
Response
<?xml version='1.0' encoding='UTF-8'?>
<places type='array' current_page='1' per_page='10' total_entries='6'>
  <place>
    <address nil='true'/>
    <created-at type='datetime'>2012-04-23T13:22:48Z</created-at>
    <description nil='true'/>
    <geo-data-id type='integer'>18442</geo-data-id>
    <id type='integer'>1117</id>
    <photo-id type='integer'>315</photo-id>
    <title>Cafe</title>
    <updated-at type='datetime'>2012-04-23T13:22:48Z</updated-at>
    <latitude type='decimal'>33.0</latitude>
    <longitude type='decimal'>44.0</longitude>
  </place></places>
{
  "current_page": 1,
  "per_page": 5,
  "total_entries": 34,
  "items": [
    {
      "place": {
        "address": null,
        "created_at": "2012-01-19T16:58:01Z",
        "description": "aaaa",
        "geo_data_id": 6,
        "id": 46,
        "photo_id": 1,
        "title": "I'm here",
        "updated_at": "2012-01-19T16:58:01Z",
        "latitude": "89.0",
        "longitude": "89.0"
      }
    },]
}


Retrieve place by identifier

Retrieve place by identifier

Request
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: cc3598167f68a8e95b50a4fc6607cd3a8e7f043b" \
http://api.quickblox.com/places/1119.xml
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: cc3598167f68a8e95b50a4fc6607cd3a8e7f043b" \
http://api.quickblox.com/places/1.json
Response
<?xml version='1.0' encoding='UTF-8'?>
<place>
  <address nil='true'/>
  <created-at type='datetime'>2012-04-23T13:34:44Z</created-at>
  <description nil='true'/>
  <geo-data-id type='integer'>18447</geo-data-id>
  <id type='integer'>1119</id>
  <photo-id type='integer'>318</photo-id>
  <title>Cafe</title>
  <updated-at type='datetime'>2012-04-23T13:34:44Z</updated-at>
  <latitude type='decimal'>35.0</latitude>
  <longitude type='decimal'>46.0</longitude>
</place>
{
  "place": {
    "address": null,
    "created_at": "2012-03-22T15:20:15Z",
    "description": null,
    "geo_data_id": 77,
    "id": 71,
    "photo_id": 85,
    "title": "Museum",
    "updated_at": "2012-03-22T15:20:15Z",
    "latitude": "33.0",
    "longitude": "44.0"
  }
}


Update place by identifier

Update place by identifier

Parameters
Param Required Type Value Example Description
place[photo_id] Optional Unsigned Integer 45 ID of file representing a photo of the place(Content module)
place[geo_data_id] Optional Unsigned Integer 5 ID of geo_data with coordinates of the place
place[title] Optional String My place Place title
place[description] Optional String Kharkov place Place description
place[address] Optional String Lenina str, 45 Place address


Request
curl -X PUT \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: d8ce187252586113e2c7f470abb48c94754a208f" \
-d "place[title]=Kharkov" \
http://api.quickblox.com/places/1030.xml?
curl -X POST \
-H "Content-Type: application/json" \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: c2ddcb6c3f61ca2ff6a6e69c09540e9b55e30302" \
-d '{"place": {"title": "My sity"}}' \
http://api.quickblox.com/places/71.json
Response
<?xml version="1.0" encoding="UTF-8"?>
<place>
  <address nil="true"></address>
  <created-at type="datetime">2012-03-20T10:26:07Z</created-at>
  <description nil="true"></description>
  <geo-data-id type="integer">60</geo-data-id>
  <id type="integer">1030</id>
  <photo-id type="integer" nil="true"></photo-id>
  <title>Kharkov</title>
  <updated-at type="datetime">2012-03-20T10:29:13Z</updated-at>
  <latitude type="decimal">50.0</latitude>
  <longitude type="decimal">36.0</longitude>
</place>
{
  "place": {
    "address": null,
    "created_at": "2012-03-22T15:20:15Z",
    "description": null,
    "geo_data_id": 77,
    "id": 71,
    "photo_id": 85,
    "title": "GreatPlace",
    "updated_at": "2012-03-22T15:41:46Z",
    "latitude": "33.0",
    "longitude": "44.0"
  }
}


Delete place by identifier

Delete place by identifier. After a place was deleted a geodata was deleted too.

Request
curl -X DELETE  \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: d8ce187252586113e2c7f470abb48c4754a208f" \
http://api.quickblox.com/places/1030.xml
curl -X DELETE  \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: d8ce187252586113e2c7f470abb48c4754a208f" \
http://api.quickblox.com/places/1031.json
Response
Empty body, status: 200
Status: 200, null