Private API¶
Authorization¶
To use Balancy's API you need to send Authorization
header with you game private key.
Add into Authorization
header of API request: Authorization: Bearer your_game_private_key
.
Profiles¶
Using API you can:
-
Get user profile:
GET
requesthttps://api-lb-1.prd.balancy.dev/v2/pr/games/<game_guid>/saves/<balancy_user_id>/collections/<collection_name>?env=<environment>
.For example, using curl:
curl -v -X GET -H "Content-Type: application/json" \ -H "Authorization: Bearer MDM0NGE1NTRhZTMDM0NGE1NTRhZT" \ "https://api-lb-1.prd.balancy.dev/v2/pr/games/11111111-1111-1111-1111-0684909fddca/saves/22222222-1111-1111-1111-0684909fddca/collections/MyProfile?env=0"
In response, you will get info about existing objects in this collection:
[{"value":{"count":1},"key":"Items","version":0}]
. -
Update user profile:
PATCH
requesthttps://api-lb-1.prd.balancy.dev/v2/pr/games/<game_guid>/saves/<balancy_user_id>/collections/<collection_name>/<key>?env=<environment>
. And passvalue
object field withversion
. Forversion
you can send-1
.For example, using curl:
curl -v -X PATCH -H "Content-Type: application/json" \ -H "Authorization: Bearer MDM0NGE1NTRhZTMDM0NGE1NTRhZT" \ --data "{\"value\": {\"count\": 100}, \"version\": -1}" \ "https://api-lb-1.prd.balancy.dev/v2/pr/games/11111111-1111-1111-1111-0684909fddca/saves/22222222-1111-1111-1111-0684909fddca/collections/MyProfile/Items/?env=0"
In response you will receive new version:
{"version":1}
.