0%

地库 API

Global rules

Request

  1. Requests are MOSTLY without body, just METHOD /example
  2. Some request may need sending a JSON. The JSON MUST be put in HTTP body

Response

  1. All responses MUST be transported using JSON object as body

  2. All responses MUST contain status as below

    "success" MUST exists, type: bool

    if "success" == false, you CAN get error message via "error_msg": "str" and "error_id": int

  3. The response content MUST be stored in the result element of object type

Example:

1
2
3
4
5
6
{
"success": true,
"result" : {
....
}
}
1
2
3
4
5
{
"success": false,
"error_msg": "error description",
"errro_id": 23333
}

Map APIs

Create a new map ID

Request:

POST /map

Response:

1
2
3
{
"id": 1212
}

Update: 2016-10-14

Request:

PATCH /map/<id>

1
2
3
4
5
{
"desc": "str of description",
"lon": 2.333333,
"lat": -23.33333
}

Response: (empty JSON object)

1
2
{
}

Upload map GeoJSON

Request:

PUT /map/<id>/geojson

1
<GeoJSON content>

Response: (empty JSON object)

Get map GeoJSON

Request:

GET /map/<id>/geojson

Response:

1
<GeoJSON content>

Get nearest map ID

Request:

GET /map/near/<lat>/<lon>

Response:

1
2
3
4
{
"id": 233,
"distance": 1212.2
}

distance is the distance of your position and map by meters

Delete map

Request:

DELETE /map/<id>

Response: (empty JSON object)