地库 API

Wafer Li ... 2016-10-14 工程
  • 工程
  • 大创
小于 1 分钟

# 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:

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

# Map APIs

# Create a new map ID

Request:

POST /map

Response:

{
   "id": 1212
}
1
2
3

# Update: 2016-10-14

Request:

PATCH /map/<id>

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

Response: (empty JSON object)

{
}
1
2

# Upload map GeoJSON

Request:

PUT /map/<id>/geojson

<GeoJSON content>
1

Response: (empty JSON object)

# Get map GeoJSON

Request:

GET /map/<id>/geojson

Response:

<GeoJSON content>
1

# Get nearest map ID

Request:

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

Response:

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

distance is the distance of your position and map by meters

# Delete map

Request:

DELETE /map/<id>

Response: (empty JSON object)