Updated RPC API (markdown)
parent
68d3199dcb
commit
f756dcc972
121
RPC-API.md
121
RPC-API.md
@ -1,22 +1,57 @@
|
|||||||
# General
|
The following RPCs are supported and can be called at the `https://api.btcmap.org/rpc` end point.
|
||||||
|
|
||||||
The following RPCs are supported
|
Most calls require an access token, which have fine-grained permissions. Please email hello@btcmap.org or jump into our [Discord](https://discord.gg/wPqva83uzq) to request one.
|
||||||
|
|
||||||
* [search](#search)
|
The general RPC format is as follows:
|
||||||
|
|
||||||
|
```
|
||||||
|
payload = {
|
||||||
|
"jsonrpc": "2.0",
|
||||||
## search
|
"method": method,
|
||||||
|
"params": params,
|
||||||
- token
|
"id": 1
|
||||||
- query
|
}
|
||||||
|
|
||||||
```bash
|
|
||||||
curl --data-binary '{"jsonrpc": "2.0", "method": "search", "params": {"password": "xxx", "query": "query", "id": 1}' https://api.btcmap.org/rpc
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Example response to a `berlin` query param :
|
Tokens should be passed in the header accordingly: `Authorization': 'Bearer <TOKEN>'`
|
||||||
|
|
||||||
|
* General RPCs
|
||||||
|
* [/search](#/search)
|
||||||
|
* Element RPCs
|
||||||
|
* [/get_element](#/get_element)
|
||||||
|
* [/set_element_tag](#/set_element_tag)
|
||||||
|
* [/remove_element_tag](#/remove_element_tag)
|
||||||
|
* [/boost_element](#/boost_element)
|
||||||
|
* [/add_element_comment](#/add_element_comment)
|
||||||
|
* Area RPCs
|
||||||
|
* [/add_area](#/add_area)
|
||||||
|
* [/get_area](#g/et_area)
|
||||||
|
* [/remove_area](#/remove_area)
|
||||||
|
* [/set_area_tag](#s/et_area_tag)
|
||||||
|
* [/remove_area_tag](#r/emove_area_tag)
|
||||||
|
* [/add_area](#/add_area)
|
||||||
|
* [/get_trending_countries](#/get_trending_countries)
|
||||||
|
* [/get_trending_communities](#/get_trending_communities)
|
||||||
|
|
||||||
|
***
|
||||||
|
|
||||||
|
|
||||||
|
# General RPCs
|
||||||
|
|
||||||
|
## /search
|
||||||
|
|
||||||
|
### Params
|
||||||
|
|
||||||
|
`query` : Free text
|
||||||
|
|
||||||
|
### Example request
|
||||||
|
```bash
|
||||||
|
curl --data-binary '{"jsonrpc": "2.0", "method": "search", "params": {"query": "This is my query", "id": 1}' https://api.btcmap.org/rpc
|
||||||
|
```
|
||||||
|
|
||||||
|
### Example response
|
||||||
|
|
||||||
|
This is an example response to a `berlin` query param :
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
@ -47,17 +82,24 @@ Example response to a `berlin` query param :
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
# Elements
|
# Element RPCs
|
||||||
|
|
||||||
## get_element
|
## get_element
|
||||||
|
|
||||||
- token
|
### Params
|
||||||
- id
|
|
||||||
|
`id` : OSM element in the form `element_type:id`. e.g. `node:12345` or `way:12345`.
|
||||||
|
|
||||||
|
### Example request
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl --data-binary '{"jsonrpc": "2.0", "method": "get_element", "params": {"password": "xxx", "id": "node:12141608846"}, "id": 1}' https://api.btcmap.org/rpc
|
curl --data-binary '{"jsonrpc": "2.0", "method": "get_element", "params": {"id": "node:12141608846"}, "id": 1}' https://api.btcmap.org/rpc
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Example reponse
|
||||||
|
|
||||||
|
_TODO_
|
||||||
|
|
||||||
## set_element_tag
|
## set_element_tag
|
||||||
|
|
||||||
- token
|
- token
|
||||||
@ -65,7 +107,7 @@ curl --data-binary '{"jsonrpc": "2.0", "method": "get_element", "params": {"pass
|
|||||||
- value
|
- value
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl --data-binary '{"jsonrpc": "2.0", "method": "set_element_tag", "params": {"password": "xxx", "id": "node:12141608846", "name": "foo", "value": "bar"}, "id": 1}' https://api.btcmap.org/rpc
|
curl --data-binary '{"jsonrpc": "2.0", "method": "set_element_tag", "params": {"id": "node:12141608846", "name": "foo", "value": "bar"}, "id": 1}' https://api.btcmap.org/rpc
|
||||||
```
|
```
|
||||||
|
|
||||||
## remove_element_tag
|
## remove_element_tag
|
||||||
@ -75,7 +117,7 @@ curl --data-binary '{"jsonrpc": "2.0", "method": "set_element_tag", "params": {"
|
|||||||
- tag
|
- tag
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl --data-binary '{"jsonrpc": "2.0", "method": "remove_element_tag", "params": {"password": "xxx", "id": "node:12141608846", "tag": "foo"}, "id": 1}' https://api.btcmap.org/rpc
|
curl --data-binary '{"jsonrpc": "2.0", "method": "remove_element_tag", "params": {"id": "node:12141608846", "tag": "foo"}, "id": 1}' https://api.btcmap.org/rpc
|
||||||
```
|
```
|
||||||
|
|
||||||
## boost_element
|
## boost_element
|
||||||
@ -85,7 +127,7 @@ curl --data-binary '{"jsonrpc": "2.0", "method": "remove_element_tag", "params":
|
|||||||
- days
|
- days
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl --data-binary '{"jsonrpc": "2.0", "method": "boost_element", "params": {"password": "xxx", "id": "node:12141608846", "days": 7}, "id": 1}' https://api.btcmap.org/rpc
|
curl --data-binary '{"jsonrpc": "2.0", "method": "boost_element", "params": {"id": "node:12141608846", "days": 7}, "id": 1}' https://api.btcmap.org/rpc
|
||||||
```
|
```
|
||||||
|
|
||||||
## add_element_comment
|
## add_element_comment
|
||||||
@ -95,12 +137,11 @@ curl --data-binary '{"jsonrpc": "2.0", "method": "boost_element", "params": {"pa
|
|||||||
- comment
|
- comment
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl --data-binary '{"jsonrpc": "2.0", "method": "add_element_comment", "params": {"password": "xxx", "id": "node:12141608846", "comment": "test comment"}, "id": 1}' https://api.btcmap.org/rpc
|
curl --data-binary '{"jsonrpc": "2.0", "method": "add_element_comment", "params": {"id": "node:12141608846", "comment": "test comment"}, "id": 1}' https://api.btcmap.org/rpc
|
||||||
```
|
```
|
||||||
|
|
||||||
<!-- ## generateelementissues -->
|
|
||||||
|
|
||||||
# Areas
|
# Area RPCs
|
||||||
|
|
||||||
## add_area
|
## add_area
|
||||||
|
|
||||||
@ -108,7 +149,7 @@ curl --data-binary '{"jsonrpc": "2.0", "method": "add_element_comment", "params"
|
|||||||
- tags
|
- tags
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl --data-binary '{"jsonrpc": "2.0", "method": "add_area", "params": {"password": "xxx", "tags": {"url_alias": "test-area", "geo_json": {"type":"Point","coordinates":[0,0]}}}, "id": 1}' https://api.btcmap.org/rpc
|
curl --data-binary '{"jsonrpc": "2.0", "method": "add_area", "params": {"tags": {"url_alias": "test-area", "geo_json": {"type":"Point","coordinates":[0,0]}}}, "id": 1}' https://api.btcmap.org/rpc
|
||||||
```
|
```
|
||||||
|
|
||||||
## get_area
|
## get_area
|
||||||
@ -117,7 +158,16 @@ curl --data-binary '{"jsonrpc": "2.0", "method": "add_area", "params": {"passwor
|
|||||||
- id
|
- id
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl --data-binary '{"jsonrpc": "2.0", "method": "get_area", "params": {"password": "xxx", "id": "test-area"}, "id": 1}' https://api.btcmap.org/rpc
|
curl --data-binary '{"jsonrpc": "2.0", "method": "get_area", "params": {"id": "test-area"}, "id": 1}' https://api.btcmap.org/rpc
|
||||||
|
```
|
||||||
|
|
||||||
|
## remove_area
|
||||||
|
|
||||||
|
- token
|
||||||
|
- id
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl --data-binary '{"jsonrpc": "2.0", "method": "remove_area", "params": {"id": "test-area"}, "id": 1}' https://api.btcmap.org/rpc
|
||||||
```
|
```
|
||||||
|
|
||||||
## set_area_tag
|
## set_area_tag
|
||||||
@ -128,7 +178,7 @@ curl --data-binary '{"jsonrpc": "2.0", "method": "get_area", "params": {"passwor
|
|||||||
- value
|
- value
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl --data-binary '{"jsonrpc": "2.0", "method": "set_area_tag", "params": {"password": "xxx", "id": "test-area", "name": "foo", "value": "bar"}, "id": 1}' https://api.btcmap.org/rpc
|
curl --data-binary '{"jsonrpc": "2.0", "method": "set_area_tag", "params": {"id": "test-area", "name": "foo", "value": "bar"}, "id": 1}' https://api.btcmap.org/rpc
|
||||||
```
|
```
|
||||||
|
|
||||||
## remove_area_tag
|
## remove_area_tag
|
||||||
@ -138,7 +188,7 @@ curl --data-binary '{"jsonrpc": "2.0", "method": "set_area_tag", "params": {"pas
|
|||||||
- tag
|
- tag
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl --data-binary '{"jsonrpc": "2.0", "method": "remove_area_tag", "params": {"password": "xxx", "id": "test-area", "tag": "foo"}, "id": 1}' https://api.btcmap.org/rpc
|
curl --data-binary '{"jsonrpc": "2.0", "method": "remove_area_tag", "params": {"id": "test-area", "tag": "foo"}, "id": 1}' https://api.btcmap.org/rpc
|
||||||
```
|
```
|
||||||
|
|
||||||
## get_trending_countries
|
## get_trending_countries
|
||||||
@ -148,7 +198,7 @@ curl --data-binary '{"jsonrpc": "2.0", "method": "remove_area_tag", "params": {"
|
|||||||
- period_end
|
- period_end
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl --data-binary '{"jsonrpc": "2.0", "method": "get_trending_countries", "params": {"password": "xxx", "period_start": "2024-01-01", "period_end": "2024-02-01"}, "id": 1}' https://api.btcmap.org/rpc
|
curl --data-binary '{"jsonrpc": "2.0", "method": "get_trending_countries", "params": {""period_start": "2024-01-01", "period_end": "2024-02-01"}, "id": 1}' https://api.btcmap.org/rpc
|
||||||
```
|
```
|
||||||
|
|
||||||
## get_trending_communities
|
## get_trending_communities
|
||||||
@ -158,14 +208,5 @@ curl --data-binary '{"jsonrpc": "2.0", "method": "get_trending_countries", "para
|
|||||||
- period_end
|
- period_end
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl --data-binary '{"jsonrpc": "2.0", "method": "get_trending_communities", "params": {"password": "xxx", "period_start": "2024-01-01", "period_end": "2024-02-01"}, "id": 1}' https://api.btcmap.org/rpc
|
curl --data-binary '{"jsonrpc": "2.0", "method": "get_trending_communities", "params": {"period_start": "2024-01-01", "period_end": "2024-02-01"}, "id": 1}' https://api.btcmap.org/rpc
|
||||||
```
|
```
|
||||||
|
|
||||||
## remove_area
|
|
||||||
|
|
||||||
- token
|
|
||||||
- id
|
|
||||||
|
|
||||||
```bash
|
|
||||||
curl --data-binary '{"jsonrpc": "2.0", "method": "remove_area", "params": {"password": "xxx", "id": "test-area"}, "id": 1}' https://api.btcmap.org/rpc
|
|
||||||
```
|
|
Loading…
x
Reference in New Issue
Block a user