Skip to content

Commit 932f621

Browse files
committed
Update documentation
1 parent 162de0d commit 932f621

File tree

7 files changed

+84
-65
lines changed

7 files changed

+84
-65
lines changed

README.md

Lines changed: 5 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -8,48 +8,14 @@ A scraper for Black Desert Online player in-game data with a REST API. It curren
88
- [Ikusa](https://ikusa.site) ([Source](https://github.com/sch-28/ikusa_api)): a powerful tool that allows you to analyze your game logs and gain valuable insights into your combat performance.
99

1010
## How to start using it
11-
There are two ways to use this API in your apps:
12-
* https://bdo.hemlo.cc/communityapi/v1 is the "official" instance hosted by me. Using it is easy but it may be slow or even become unresponsive. The API documentation can be viewed [here](https://gitlab.com/man90/black-desert-social-rest-api/-/tree/master/doc/api/openapi.json).
13-
* If you want to have more control over the API, host the scraper yourself. The repository is preconfigured to be deployable on Heroku, can be easily deployed with Docker or built manually for a VPS/VDS. To do this, follow these steps:
14-
1. Build the server from the source code following [this guide](doc/buildingFromSource.md).
15-
2. (Optional) Set the environment variables. The list of available variables is in the section below.
16-
3. Run the binary. Possible flags are described in a section below.
17-
4. Use the API as described in the [documentation](https://gitlab.com/man90/black-desert-social-rest-api/-/tree/master/doc/api/openapi.json).
11+
There are two ways to use this scraper for your needs:
12+
* By querying https://bdo.hemlo.cc/communityapi/v1 — this is the "official" instance hosted by me.
13+
* If you want to have more control over the API, host the scraper yourself. It's [available on DockerHub](https://hub.docker.com/repository/docker/man90/bdo-rest-api) (exposes port 8001), preconfigured for Heroku, and can be built from source as described in [this guide](docs/buildingFromSource.md) (this gives you a bit more control over how the scraper behaves).
1814

19-
## Environment variables
20-
Catch requests on a specific port (8001 by default):
21-
```bash
22-
export PORT=3000
23-
```
24-
25-
Use a proxy to make requests to BDO servers (direct by default):
26-
```bash
27-
export PROXY=http://123.123.123.123:8080
28-
# or
29-
export PROXY="http://123.123.123.123:8080 http://124.124.124.124:8081"
30-
```
31-
32-
## Flags
33-
These flags override environment variables.
34-
```
35-
-cachecap int
36-
Cache capacity (default 10000)
37-
-cachettl int
38-
Cache TTL in minutes (default 180)
39-
-port int
40-
Port to catch requests on (default 8001)
41-
-proxy string
42-
Open proxy address to make requests to BDO servers
43-
-verbose
44-
Print out additional logs into stdout
45-
```
46-
Use them like this:
47-
```bash
48-
./bdo-rest-api -proxy="http://192.168.0.0.1:8080" -cachettl=30
49-
```
15+
API documentation can be viewed [here](https://octoman90.github.io/BDO-REST-API/).
5016

5117
## Known bugs
52-
There is a number of bugs that the official BDO website has. This collector does not do anything about them for the sake of simplicity, so your apps may need to use the [workarounds](doc/brokenStuff.md).
18+
There is a number of bugs that the official BDO website has. This scraper does not do anything about them for the sake of simplicity, so your apps may need to use [workarounds](docs/brokenStuff.md).
5319

5420
## Contributing
5521
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

doc/buildingFromSource.md

Lines changed: 0 additions & 12 deletions
This file was deleted.
File renamed without changes.

docs/buildingFromSource.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Building from source
2+
Building the scraper from source may be preferable in some cases. This way, the app has a smaller footprint and gives you more control than a [Docker image](https://hub.docker.com/repository/docker/man90/bdo-rest-api).
3+
4+
## Prerequisites:
5+
- GNU/Linux (other platforms should work as well but I haven't tested them)
6+
- Go compiler >=v1.15
7+
8+
## Compilation
9+
By default, scraped results are cached in memory and stored for up to 2 hours. This helps to ease the pressure on BDO servers and decreases the response time tremendously (for cached responses). Use this command to compile the app:
10+
```bash
11+
go build
12+
```
13+
14+
If you don't want to cache scraped results (e.g., if you are 100% sure that there will be no similar requests sent to the API), you can also use this command instead:
15+
```bash
16+
go build -tags "cacheless"
17+
```
18+
19+
## Environment variables
20+
Catch requests on a specific port (8001 by default):
21+
```bash
22+
export PORT=3000
23+
```
24+
25+
Use a proxy to make requests to BDO servers (direct by default):
26+
```bash
27+
export PROXY=http://123.123.123.123:8080
28+
# or
29+
export PROXY="http://123.123.123.123:8080 http://124.124.124.124:8081"
30+
```
31+
32+
## Flags
33+
These flags override environment variables.
34+
```
35+
-cachecap int
36+
Cache capacity (default 10000)
37+
-cachettl int
38+
Cache TTL in minutes (default 180)
39+
-port int
40+
Port to catch requests on (default 8001)
41+
-proxy string
42+
Open proxy address to make requests to BDO servers
43+
-verbose
44+
Print out additional logs into stdout
45+
```
46+
47+
Use them like this:
48+
```bash
49+
./bdo-rest-api -proxy="http://192.168.0.0.1:8080" -cachettl=30
50+
```

docs/index.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!DOCTYPE html>
2+
3+
<title>BDO-REST-API documentation</title>
4+
<meta charset="utf-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
<link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700" rel="stylesheet">
7+
<style>
8+
body {
9+
margin: 0;
10+
padding: 0;
11+
}
12+
</style>
13+
14+
<redoc spec-url="https://raw.githubusercontent.com/octoman90/BDO-REST-API/master/docs/openapi.json"></redoc>
15+
<script src="https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js"></script>
File renamed without changes.

doc/api/openapi.json renamed to docs/openapi.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
},
77
"servers": [
88
{
9-
"url": "https://bdo.hemlo.cc/communityapi/v1"
9+
"url": "https://bdo.hemlo.cc/communityapi"
1010
},
1111
{
12-
"url": "http://localhost:8001/v1"
12+
"url": "http://localhost:8001"
1313
}
1414
],
1515
"components": {
@@ -21,7 +21,7 @@
2121
"schema": {
2222
"type": "string",
2323
"enum": ["EU", "NA", "SA"],
24-
"example": "EU"
24+
"default": "EU"
2525
}
2626
}
2727
},
@@ -33,15 +33,15 @@
3333
"description": "Not Found: try requesting something else."
3434
},
3535
"503": {
36-
"description": "Service Unavailable: [https://naeu.playblackdesert.com](naeu.playblackdesert.com) is currently under maintenance and the data requested is not cached."
36+
"description": "Service Unavailable: [https://naeu.playblackdesert.com](naeu.playblackdesert.com) is currently under maintenance and requested data is not cached."
3737
}
3838
}
3939
},
4040
"paths": {
41-
"/adventurer": {
41+
"/v1/adventurer": {
4242
"get": {
4343
"summary": "Retrieve player's profile.",
44-
"description": "Retrieve the full profile of a single player by his or her profileTarget.",
44+
"description": "Retrieve the full profile of a single player by his or her profileTarget. Watch out for the \"privacy\" attribute that is added to the response when the player whose profile is requested turned on at least one of the privacy options BDO website has. It is a single number that you can decode using bitmasks. `0b0001` for private character levels, `0b0010` for private guild, `0b0100` for private contribution points and `0b1000` for private lifeskill levels. If the attribute is equal to `0b1111` then everything is set to private.",
4545
"operationId": "getAdventurer",
4646
"parameters": [
4747
{
@@ -60,13 +60,13 @@
6060
"schema": {
6161
"type": "string",
6262
"enum": ["EU", "NA", "SA"],
63-
"example": "EU"
63+
"default": "EU"
6464
}
6565
}
6666
],
6767
"responses": {
6868
"200": {
69-
"description": "Watch out for the \"privacy\" attribute that is added to the response when the player whose profile is requested turned on at least one of the privacy options BDO website has. It is a single number that you can decode using bitmasks. `0b0001` for private character levels, `0b0010` for private guild, `0b0100` for private contribution points and `0b1000` for private lifeskill levels. If the attribute is equal to `0b1111` then everything is set to private.",
69+
"description": "OK.",
7070
"content": {
7171
"application/json": {
7272
"schema": {
@@ -190,7 +190,7 @@
190190
}
191191
}
192192
},
193-
"/adventurer/search": {
193+
"/v1/adventurer/search": {
194194
"get": {
195195
"summary": "Search for a player.",
196196
"description": "Search for a player by a combination of his or her region and family/character name.",
@@ -249,7 +249,7 @@
249249
},
250250
"region": {
251251
"type": "string",
252-
"enum": ["EU", "NA"]
252+
"enum": ["EU", "NA", "SA"]
253253
},
254254
"guild": {
255255
"properties": {
@@ -301,7 +301,7 @@
301301
}
302302
}
303303
},
304-
"/guild": {
304+
"/v1/guild": {
305305
"get": {
306306
"summary": "Retrieve guild profile.",
307307
"description": "Retrieve the profile of a guild by its name.",
@@ -335,7 +335,7 @@
335335
},
336336
"region": {
337337
"type": "string",
338-
"enum": ["EU", "NA"]
338+
"enum": ["EU", "NA", "SA"]
339339
},
340340
"createdOn": {
341341
"type": "string",
@@ -395,7 +395,7 @@
395395
}
396396
}
397397
},
398-
"/guild/search": {
398+
"/v1/guild/search": {
399399
"get": {
400400
"summary": "Search for a guild.",
401401
"description": "Search for a guild by combination of its region and name.",
@@ -440,7 +440,7 @@
440440
},
441441
"region": {
442442
"type": "string",
443-
"enum": ["EU", "NA"]
443+
"enum": ["EU", "NA", "SA"]
444444
},
445445
"createdOn": {
446446
"type": "string",

0 commit comments

Comments
 (0)