Destroyed RPC API (markdown)

Nathan Day 2025-03-03 14:26:17 +00:00
parent 0998bb4045
commit 67fef8392c

@ -1,220 +0,0 @@
The following RPCs are supported and can be called at the `https://api.btcmap.org/rpc` end point.
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.
The general RPC format is as follows:
```
payload = {
"jsonrpc": "2.0",
"method": method,
"params": params,
"id": 1
}
```
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
{
"id": 1,
"jsonrpc": "2.0",
"result": [
{
"id": 155,
"name": "Bitcoin Berlin El Salvador",
"type": "area"
},
{
"id": 54,
"name": "Berlin 2140",
"type": "area"
},
{
"id": 257,
"name": "Einundzwanzig Berlin",
"type": "area"
},
{
"id": 77,
"name": "Bitcoin Berlin El Salvador",
"type": "area"
}
]
}
```
# Element RPCs
## get_element
### Params
`id` : OSM element in the form `element_type:id`. e.g. `node:12345` or `way:12345`.
### Example request
```bash
curl --data-binary '{"jsonrpc": "2.0", "method": "get_element", "params": {"id": "node:12141608846"}, "id": 1}' https://api.btcmap.org/rpc
```
### Example response
_TODO_
## set_element_tag
This sets tags on elements within BTC Map only - these are not tags directly on OSM elements.
### Params
`id` : OSM element in the form `element_type:id`. e.g. `node:12345` or `way:12345`.
`name` : Tag name. Free text.
`value` : Tag value. Free text.
### Example request
```bash
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
- token
- id
- tag
```bash
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
- token
- id
- days
```bash
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
- token
- id
- comment
```bash
curl --data-binary '{"jsonrpc": "2.0", "method": "add_element_comment", "params": {"id": "node:12141608846", "comment": "test comment"}, "id": 1}' https://api.btcmap.org/rpc
```
# Area RPCs
## add_area
- token
- tags
```bash
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
- token
- id
```bash
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
- token
- id
- name
- value
```bash
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
- token
- id
- tag
```bash
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
- token
- period_start
- period_end
```bash
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
- token
- period_start
- period_end
```bash
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
```