Getting Started
First, head to the User zone, log in, and get your API key. To re-use it in future commands, we'll save it inside a environment variable
export SPACE_BOTS_API_TOKEN=spbo_yourtoken
When you logged in for the first time, the game created a fleet for you. List your fleets by doing:
curl https://space-bots.longwelwind.net/v1/fleets/my \
--header "Authorization: Bearer $SPACE_BOTS_API_TOKEN" | json_pp
[
{
"capacity": 10,
"cargo": {},
"currentAction": null,
"id": "$FLEET_ID",
"locationSystemId": "omega",
"owner": {
"type": "user",
"userId": "$USER_ID"
},
"ships": {
"miner": 1
}
}
]
Notice that this fleet is composed of a miner
ship, that is located in the omega
system and that it doesn't contain anything in their cargo.
Note down the id
of this fleet, in the folowing step, it will be refered as $FLEET_ID
.
You can get information about the system omega
by executing:
curl https://space-bots.longwelwind.net/v1/systems/omega \
--header "Authorization: Bearer $SPACE_BOTS_API_TOKEN" \
| json_pp
{
"id": "omega",
"name": "Omega",
"neighboringSystems": [
{
"systemId": "sigma"
},
{
"systemId": "tashornia"
},
{
"systemId": "mega-torox"
},
{
"systemId": "legaka"
}
],
"station": {
"directSell": true,
"buyShips": true,
"cargo": {}
},
"x": 0,
"y": 0
}
Notice that this system has 4 neighbouring systems, and that it doesn't contain any asteroid belt (as seen by the absence of a asteroid
field)
Let's get information about mega-torox
, one of the four neighbouring systems:
curl https://space-bots.longwelwind.net/v1/systems/mega-torox \
--header "Authorization: Bearer $SPACE_BOTS_API_TOKEN" | json_pp
{
"asteroid": {
"miningResourceId": "iron_ore"
},
"id": "mega-torox",
"name": "Mega Torox",
"neighboringSystems": [
{
"systemId": "omega"
},
{
"systemId": "duovin-anaon"
}
],
"x": 2,
"y": 2
}
We can see that this system has an asteroid belt containing iron_ore
!
Let's move our fleet to mega-torox
:
curl -X POST https://space-bots.longwelwind.net/v1/fleets/$FLEET_ID/travel \
--header "Authorization: Bearer $SPACE_BOTS_API_TOKEN" \
-H "Content-Type: application/json" \
--data '{"destinationSystemId": "mega-torox"}' | json_pp
{
"status": "ok",
"arrivalTime": "2023-11-05T12:01:22.794Z"
}
Your fleet will take some time before arriving to mega-torox
.
Wait until your fleet has arrived to mega-torox
, and then order it start mining the asteroid belt:
curl -X POST https://space-bots.longwelwind.net/v1/fleets/$FLEET_ID/mine \
--header "Authorization: Bearer $SPACE_BOTS_API_TOKEN" | json_pp
{
"status": "ok",
"finishTime": "2023-11-04T13:00:44.207Z",
"duration": 4
}
It will also take some time before your fleet has finished mining the asteroid. You can check the status of the fleet by executing:
curl --header "Authorization: Bearer $SPACE_BOTS_API_TOKEN" \
https://space-bots.longwelwind.net/v1/fleets/{fleet_id} | json_pp
{
"cargo": {
"iron_ore": 1
},
"currentAction": null,
"id": "$FLEET_ID",
"locationSystemId": "mega-torox",
"owner": {
"type": "user",
"userId": "$USER_ID"
},
"ships": {
"miner": 1
}
}
Notice that there is now 1 iron ore in the cargo of your fleet!
Travel back to the original system
curl -X POST https://space-bots.longwelwind.net/v1/fleets/$FLEET_ID/travel \
--header "Authorization: Bearer $SPACE_BOTS_API_TOKEN" \
-H "Content-Type: application/json" \
--data '{"destinationSystemId": "omega"}' | json_pp
{
"status": "ok",
"arrivalTime": "2023-11-05T12:01:22.794Z",
"duration": 4
}
Let's sell this iron ore in the station
curl -X POST https://space-bots.longwelwind.net/v1/fleets/$FLEET_ID/direct-sell \
--header "Authorization: Bearer $SPACE_BOTS_API_TOKEN" \
-H "Content-Type: application/json" \
--data '{"resources": {"iron_ore": 1}}' | json_pp
{
"status": "ok",
"creditsGained": 10
}
Resources can also be sold on the player market by calling
/systems/omega/market/resources/iron_ore/instant-sell
if others players
have placed buy orders, but /fleets/$FLEET_ID/direct-sell
provides a flat
price for which you can sell your resources.
And voila! You have mined, and sold, your first resources in Space Bots!
You can repeat this process a few times to get more credits. Once you have 5 credits, you can buy an other mining ship:
curl -X POST https://space-bots.longwelwind.net/v1/fleets/$FLEET_ID/buy-ships \
--header "Authorization: Bearer $SPACE_BOTS_API_TOKEN" \
-H "Content-Type: application/json" \
--data '{"shipsToBuy": {"miner_mk_i": 1}}' | json_pp
Your fleet is now composed of 2 miner_mk_i
ships, allowing you to mine twice as much ores from an asteroid!
But this is not over! There are a lot of things that can be done in Space Bots:
- You can automate mining and selling resources using your favourite language of choice
- You can explore the universe to find systems where more valuable resources can be mined
- You can start building Station Modules to refine the resources you've mined and to start building ships with the refined resources.