1
0
forked from MTSR/mapserver

add api docs

fixes #79
This commit is contained in:
NatureFreshMilk 2020-01-23 15:56:37 +01:00
parent 2032cccd03
commit be0eae182a
2 changed files with 62 additions and 0 deletions

61
doc/api.md Normal file
View File

@ -0,0 +1,61 @@
# Api documentation
REST Api documentation
## Mapobjects
Query for `bones` / `poi`/ `shop` / etc
* **Path:** `api/mapobjects`
* **Method:** `POST`
* **Consumes:** `application/json`
* **Produces:** `application/json`
POST-Payload:
```json
{
"pos1": {
"x":-2048,
"y":-2048,
"z":-2048
},
"pos2": {
"x":2048,
"y":2048,
"z":2048
},
"type":"bones"
}
```
**Note**: `pos1` and `pos2` are in mapblocks
Example query:
```bash
curl 'http://127.0.0.1:8080/api/mapobjects/' \
-H 'Content-Type: application/json; charset=utf-8' \
--data '{"pos1":{"x":-2048,"y":-2048,"z":-2048},"pos2":{"x":2048,"y":2048,"z":2048},"type":"bones"}' \
| jq
```
Result:
```json
[{
"mapblock": {
"x": -1671,
"y": 0,
"z": -82
},
"x": -26729,
"y": 1,
"z": -1306,
"type": "bones",
"mtime": 1554099532,
"attributes": {
"owner": "Brzezowski58",
"time": "0"
}
}]
```

View File

@ -33,6 +33,7 @@ Demo: [Pandorabox Server map](https://pandorabox.io/map/#-1782.25/493.5/10)
* [Configuration](doc/config.md)
* [Recommended specs](doc/recommended_specs.md)
* [Stats webfragment](doc/stats_webfragment.md)
* [Web API](doc/api.md)
* [Contribution](doc/contrib.md)
* [Development](doc/dev.md)
* [License](doc/license.md)