Creating Players
Production use cases utilize API endpoints to create players.
This is done by calling the Create Player endpoint.
curl --location 'https://core-api.stardust.gg/v2/player/create' \
--header 'x-api-key: {{API_KEY}}' \
--header 'Content-Type: application/json' \
--data '{
"uniqueId": "888",
"image": "https://labs.openai.com/s/pxiXnFmayBgnBxqBpUdGOeBt",
"userData": {
"exp": 0,
"premium": false,
"username": "hotpotato123"
}
}'
A player object consists of a uniqueId
, an image
, and userData
fields:
- uniqueId - String value that can represent a player username or an ID that exists within in your game.
- image - String value that represents an image URL for your player. This can be used to easily identifying a user in the Developer Dashboard.
- userData - JSON object containing custom descriptive traits about the user.
In response to creating a player, Stardust will return a playerId
which can used to reference the player in Stardust when performing actions such as minting a token.
{
"playerId": "e3192216-3c2e-4403-b849-77d8829648a0",
"exp": 0,
"premium": false,
"username": "hotpotato123",
"image": "https://labs.openai.com/s/pxiXnFmayBgnBxqBpUdGOeBt"
}
Storing the playerId
We recommend storing your Stardust
playerId
1-to-1 with your Unique player Id.
Player Item Balances
To see a list of Items in a Player's wallet, call List Item Balances and pass the playerId
.
Updated 7 months ago