|
| 1 | +# search |
| 2 | + |
| 3 | +## Description |
| 4 | + |
| 5 | +Performs a case-insensitive substring search across areas, places and events, returning matching records sorted by source (areas first, then places, then events). When the optional `type` filter is provided, only records of that source are returned. |
| 6 | + |
| 7 | +## Params |
| 8 | + |
| 9 | +```json |
| 10 | +{ |
| 11 | + "query": "berlin", |
| 12 | + "type": "place" |
| 13 | +} |
| 14 | +``` |
| 15 | + |
| 16 | +| Field | Type | Required | Description | |
| 17 | +| ------ | ------ | -------- | ------------------------------------------------------------------------------------------------- | |
| 18 | +| query | string | yes | The search string matched against area names, place names and event names (case-insensitive). | |
| 19 | +| type | string | no | Restricts the result set to a single source. Accepts `area`, `place` or `event`. Defaults to all. | |
| 20 | + |
| 21 | +## Result Format |
| 22 | + |
| 23 | +```json |
| 24 | +[ |
| 25 | + { |
| 26 | + "name": "Berlin", |
| 27 | + "type": "area", |
| 28 | + "id": 42 |
| 29 | + }, |
| 30 | + { |
| 31 | + "name": "Berlin Bitcoin Meetup", |
| 32 | + "type": "place", |
| 33 | + "id": 1337 |
| 34 | + }, |
| 35 | + { |
| 36 | + "name": "Bitcoin Berlin Conference", |
| 37 | + "type": "event", |
| 38 | + "id": 9 |
| 39 | + } |
| 40 | +] |
| 41 | +``` |
| 42 | + |
| 43 | +| Field | Type | Description | |
| 44 | +| ----- | ------- | ------------------------------------------------------------------------ | |
| 45 | +| name | string | Display name of the matched record. | |
| 46 | +| type | string | Source of the record: `area`, `place` or `event`. | |
| 47 | +| id | integer | Database id of the matched area, place or event. | |
| 48 | + |
| 49 | +## Allowed Roles |
| 50 | + |
| 51 | +- Root |
| 52 | +- Admin |
| 53 | +- Event Manager |
| 54 | + |
| 55 | +## Examples |
| 56 | + |
| 57 | +### curl |
| 58 | + |
| 59 | +```bash |
| 60 | +curl --header 'Content-Type: application/json' \ |
| 61 | + --header "Authorization: Bearer $ACCESS_TOKEN" \ |
| 62 | + --request POST \ |
| 63 | + --data '{"jsonrpc":"2.0","method":"search","params":{"query":"berlin"},"id":1}' \ |
| 64 | + https://api.btcmap.org/rpc |
| 65 | +``` |
| 66 | + |
| 67 | +Search only places: |
| 68 | + |
| 69 | +```bash |
| 70 | +curl --header 'Content-Type: application/json' \ |
| 71 | + --header "Authorization: Bearer $ACCESS_TOKEN" \ |
| 72 | + --request POST \ |
| 73 | + --data '{"jsonrpc":"2.0","method":"search","params":{"query":"berlin","type":"place"},"id":1}' \ |
| 74 | + https://api.btcmap.org/rpc |
| 75 | +``` |
0 commit comments