API Documentation
To get player activities information
Introduction
The Skysmash API provides functionality to check activities within the last 24 hours. This document outlines the endpoints, input parameters, and output data for the API.
Base API URL
Base URL:
https://api.skysmash.io
Authentication
To access the Skysmash API, authentication is required. Use the following endpoint to authenticate:
POST /playfabauthenticate/customAuthenticate
Header:
secretKey
: The secret key provided by Sky Smash to trusted partners (Do not share this key with anyone).
Request Body: Not required
Response (if authentication is successful):
{
"status": 0,
"data": {
"accessToken": "eyJ..."
}
}
Save the accessToken
for subsequent API requests. You must include this token in the request header as the authorization
bearer token.
API Endpoints
Check Activities within the past time frame from now
Use this endpoint to check activities 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