API Reference
Economy
Currencies + statistics for any owner (player, farm, ...)
GET
/api/plugin/economy/leaderboard Top owners by a statistic
Ranks all owners of one ownerType by a statistic in one period (highest first).
Parameters
-
gameModestring query -
limitinteger query -
namestring queryStatistic name to rank by.
-
ownerTypestring queryOwner type to rank (e.g. "farm").
-
periodstring queryDAILY/WEEKLY/MONTHLY/LIFETIME.
Responses
-
200The ranked leaderboard.
200 response
{
"ownerType": "string",
"statisticName": "string",
"gameMode": "string",
"period": "string",
"entries": [
{
"rank": 0,
"ownerKey": "string",
"value": 0
}
]
} Request
~
curl -X GET https://api.hivescale.dev/api/plugin/economy/leaderboard?gameMode=value&limit=0&name=value&ownerType=value&period=value \
-H "X-Hive-Api-Key: $HIVE_API_KEY"HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.hivescale.dev/api/plugin/economy/leaderboard?gameMode=value&limit=0&name=value&ownerType=value&period=value"))
.header("X-Hive-Api-Key", apiKey)
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response =
client.send(request, HttpResponse.BodyHandlers.ofString()); GET
/api/plugin/economy/{ownerType}/{ownerKey}/currencies List an owner's currency balances
Parameters
-
ownerKeystring path required -
ownerTypestring path required
Responses
-
200All currency balances held by the owner.
200 response
[
{
"currencyName": "string",
"balance": 0
}
] Request
~
curl -X GET https://api.hivescale.dev/api/plugin/economy/{ownerType}/{ownerKey}/currencies \
-H "X-Hive-Api-Key: $HIVE_API_KEY"HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.hivescale.dev/api/plugin/economy/{ownerType}/{ownerKey}/currencies"))
.header("X-Hive-Api-Key", apiKey)
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response =
client.send(request, HttpResponse.BodyHandlers.ofString()); POST
/api/plugin/economy/{ownerType}/{ownerKey}/currencies/modify Add to / subtract from a balance
Atomically adds the (possibly negative) amount to the owner's balance, clamped to the currency's min/max, audited in currency_transactions. Returns the new balance.
Parameters
-
ownerKeystring path required -
ownerTypestring path required
Request body
application/json
{
"currency": "string",
"amount": 0,
"reason": "string"
} Responses
-
200The updated balance. -
400Bad Request
200 response
{
"currencyName": "string",
"balance": 0
} Request
~
curl -X POST https://api.hivescale.dev/api/plugin/economy/{ownerType}/{ownerKey}/currencies/modify \
-H "X-Hive-Api-Key: $HIVE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"currency":"string","amount":0,"reason":"string"}'HttpClient client = HttpClient.newHttpClient();
String body = "{\"currency\":\"string\",\"amount\":0,\"reason\":\"string\"}";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.hivescale.dev/api/plugin/economy/{ownerType}/{ownerKey}/currencies/modify"))
.header("X-Hive-Api-Key", apiKey)
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<String> response =
client.send(request, HttpResponse.BodyHandlers.ofString()); GET
/api/plugin/economy/{ownerType}/{ownerKey}/statistics Read an owner's statistics
Parameters
-
ownerKeystring path required -
ownerTypestring path required -
gameModestring query
Responses
-
200The owner's statistics for the requested game mode.
200 response
{
"ownerType": "string",
"ownerKey": "string",
"gameMode": "string",
"statistics": [
{
"statisticName": "string",
"gameMode": "string",
"periodType": "string",
"periodStart": "string",
"value": 0,
"updatedAt": 0
}
]
} Request
~
curl -X GET https://api.hivescale.dev/api/plugin/economy/{ownerType}/{ownerKey}/statistics?gameMode=value \
-H "X-Hive-Api-Key: $HIVE_API_KEY"HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.hivescale.dev/api/plugin/economy/{ownerType}/{ownerKey}/statistics?gameMode=value"))
.header("X-Hive-Api-Key", apiKey)
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response =
client.send(request, HttpResponse.BodyHandlers.ofString()); POST
/api/plugin/economy/{ownerType}/{ownerKey}/statistics/increment Increment an owner's statistic
Adds to a named statistic and returns its new value in every period (DAILY/WEEKLY/MONTHLY/LIFETIME).
Parameters
-
ownerKeystring path required -
ownerTypestring path required
Request body
application/json
{
"name": "string",
"gameMode": "string",
"amount": 0
} Responses
-
200The updated per-period values. -
400Bad Request
200 response
{
"statisticName": "string",
"gameMode": "string",
"newValues": {}
} Request
~
curl -X POST https://api.hivescale.dev/api/plugin/economy/{ownerType}/{ownerKey}/statistics/increment \
-H "X-Hive-Api-Key: $HIVE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"string","gameMode":"string","amount":0}'HttpClient client = HttpClient.newHttpClient();
String body = "{\"name\":\"string\",\"gameMode\":\"string\",\"amount\":0}";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.hivescale.dev/api/plugin/economy/{ownerType}/{ownerKey}/statistics/increment"))
.header("X-Hive-Api-Key", apiKey)
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<String> response =
client.send(request, HttpResponse.BodyHandlers.ofString());