Get Player Gaming Activities by Time
Use this endpoint to check the number of matches played within the past time frame from now for a given Ronin Wallet Address
POST /custom/getRoninAddressBattleCount
Header:
authorization
: Bearer token with the format"bearer $accessToken"
content-type
:application/json
Request Body:
{
"roninAddress": "Ronin wallet address (start with '0x', replace 'ronin:' with '0x')",
"minutes": "Number of minutes to look back (e.g., 1440 for 24 hours, 120 for 2 hours)"
}
Response (if request is successful):
{
status: 0,
data: {
results: [
{
"Mode": "ChallengeEndless",
"Count": 0,
"Win": 5
},
{
"Mode": "TeamParty",
"Count": 2,
"Win": 1
},
{
"Mode": "RankParty",
"Count": 123,
"Win": 1
}
]
}
}
Input and Output
Input:
roninAddress
- Player's Ronin Wallet address, replacing "ronin:" with "0x"minutes -
- The duration in minutes from the current time and date to consider for historical data retrieval (e.g., use 1440 for the past 24-hour period or 120 for retrieving data in the past 2-hour). Max value 2880 - representing 2 days of activities for each players
Output:
Mode
- The text description of the game mode.Count
- The number matches played on the fore-mentioned game mode.Win
- The number of winning matches on the fore-mentioned game mode.
Example Usage
const axios = require('axios');
// Authentication
const authenticate = async () => {
const secretKey = 'your-secret-key'; // Replace with your secret key
const authUrl = 'https://api.skysmash.io/playfabauthenticate/customAuthenticate';
try {
const response = await axios.post(authUrl, {
secretKey,
});
const accessToken = response.data.data.accessToken;
return accessToken;
} catch (error) {
console.error('Authentication failed:', error.response.data);
throw error;
}
};
// Get Ronin Address Battle Count
const getRoninAddressBattleCount = async (accessToken, walletAddress, minutes) => {
const apiUrl = 'https://api.skysmash.io/custom/getRoninAddressBattleCount';
// Replace '0xYourWalletAddress' and '1440' with actual values
const data = {
roninAddress: walletAddress,
minutes: minutes,
};
const headers = {
'authorization': `bearer ${accessToken}`,
'content-type': 'application/json',
};
try {
const response = await axios.post(apiUrl, data, { headers });
const battleCountData = response.data.data;
return battleCountData;
} catch (error) {
console.error('Failed to retrieve Ronin Address battle count:', error.response.data);
throw error;
}
};
// Example usage
(async () => {
try {
const accessToken = await authenticate();
const walletAddress = '0xYourWalletAddress'; // Replace with the actual wallet address
const minutes = 1440; // Replace with the desired time frame
const battleCountData = await getRoninAddressBattleCount(accessToken, walletAddress, minutes);
console.log(battleCountData);
} catch (error) {
// Handle errors
}
})();
Remember to replace 'your-secret-key'
and '0xYourWalletAddress'
with actual secret key and wallet address.
Last updated