Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
battlefield-stats
Advanced tools
A node api for collection and analysis of battlefield 1 and battlefield 4 statistics.
A node api that allows you to collect, analyze, and serve battlefield 1 and battlefield 4 statistics. This fully makes use of the battlefield tracker network - https://battlefieldtracker.com/
npm install battlefield-stats
// API_KEY from https://battlefieldtracker.com/site-api
const bf = new BattlefieldStats(API_KEY);
const params = { personaId: xxxxxxxxx, platform: bf.Platforms.PC }
// bf.Server.quickServerInfo({platform: 3}, console.log);
bf.Api.request('/Stats/BasicStats', params, responseCallback)
Get your API Key from the battlefield tracker network here: https://battlefieldtracker.com/site-api
Install battlefield-stats using npm by running using npm install battlefield-stats
npm install battlefield-stats
const BattlefieldStats = require('battlefield-stats');
const API_KEY = 'YourAPIKeyFromBfTracker' // from https://battlefieldtracker.com/site-api
const bf = new BattlefieldStats(API_KEY);
// All params mirror params listed at http://docs.trnbattlefield.apiary.io/#
const params = {
platform: bf.Platforms.PC, // also you can use XBOX or PS4
displayName: YourOriginUserName // Or you can use personaId
}
// Proxies to all api routes found http://docs.trnbattlefield.apiary.io/#
const route = '/Stats/BasicStats';
bf.Api.request(route, params, (error, response) => {
// response callback
if (!error && response) {
console.log(response);
}
})
You can use battlefield-stats-express
which adds hooks and functionality to express middleware with this module.
npm install battlefield-stats-express
const express = require('express');
const battlefieldStats = require('battlefield-stats-express');
const app = express();
// Get or use your key from https://battlefieldtracker.com/site-api`
const bfs = battlefieldStats(YOUR_API_TOKEN);
app.use('/api', bfs)
app.listen(3000);
Now you can see results when you navigate to http://localhost:3000/api/Stats/DetailedStats?platform=3&displayName=Ravic
For more information see battlefield-stats-express on github.
This API closely follows the REST Api documentation found at http://docs.trnbattlefield.apiary.io/#
All API calls require platform
and either personaId
or displayName
, and optionally may use the game
parameter.
All the requests require a platform query parameter.
The following values are allowed: 1 for Xbox, 2 for PlayStation, and 3 for Origin. Alternatively, you can use Platforms.XBOX
, Platforms.PS4
, Platforms.PC
respectively.
Each request will also need either the personaId
or displayName
parameter, if specified.
If you're using the displayName variable be warned that for Xbox One and PlayStation 4 the api can only retrieve data if the player has played Battlefield 4 or Hardline.
Certain requests can have an optional game parameter. The default value is tunguska
, which is the codename for Battlefield 1. It's possible to set this to bf4
to get data from Battlefield 4.
This is just an enum to allow for more human readable code and is completely optional.
Platforms.XBOX
: 1
Platforms.PS4
: 2
Platforms.PC
: 3
A generic request can be made to obtain anything from the api, however at this time all are covered with the rest of the apis.
const route = '/Stats/CareerForOwnedGames';
const params = { platform: bf.Platforms.XBOX, personaId: xxxxxxxxx };
bf.Api.request(route, params, console.log);
The route
argument may be any of the Request Routes
mentioned in this documentation.
Parameters: platform
, personaId
, displayName
Request Route: /Stats/CareerForOwnedGames
Usage:
const bf = new require('battlefield-stats')(YOUR_API_KEY);
const params = {
platform: bf.Platforms.PC, // also you can use XBOX or PS4
displayName: YourOriginUserName, // Or you can use personaId
}
bf.Stats.careerForOwnedGames(params, (error, response) => {
// handle response...
})
Parameters: platform
, personaId
, displayName
, game
Request Route: /Stats/BasicStats
Usage:
const bf = new require('battlefield-stats')(YOUR_API_KEY);
const params = {
platform: bf.Platforms.PC, // also you can use XBOX or PS4
displayName: YourOriginUserName, // Or you can use personaId
game: 'tunguska' // default is tunguska, can be changed to bf4
}
bf.Stats.basicStats(params, (error, response) => {
// handle response...
})
Parameters: platform
, personaId
, displayName
, game
Request Route: /Stats/DetailedStats
Usage:
const bf = new require('battlefield-stats')(YOUR_API_KEY);
const params = {
platform: bf.Platforms.PC, // also you can use XBOX or PS4
displayName: YourOriginUserName, // Or you can use personaId
game: 'tunguska' // default is tunguska, can be changed to bf4
}
bf.Stats.detailedStats(params, (error, response) => {
// handle response...
})
Parameters: platform
, game
Request Route: /Progression/GetCodex
Usage:
const bf = new require('battlefield-stats')(YOUR_API_KEY);
const params = {
platform: bf.Platforms.PC, // also you can use XBOX or PS4
game: 'tunguska' // default is tunguska, can be changed to bf4
}
bf.Progression.getCodex(params, (error, response) => {
// handle response...
})
Parameters: platform
, personaId
, displayName
, game
Request Route: /Progression/GetFilteredCodex
Usage:
const bf = new require('battlefield-stats')(YOUR_API_KEY);
const params = {
platform: bf.Platforms.PC, // also you can use XBOX or PS4
displayName: YOUR_DISPLAY_NAME
}
bf.Progression.getFilteredCodex(params, (error, response) => {
// handle response...
})
Parameters: platform
, personaId
, displayName
, game
Request Route: /Progression/GetKitRanksMap
Usage:
const bf = new require('battlefield-stats')(YOUR_API_KEY);
const params = {
platform: bf.Platforms.PC, // also you can use XBOX or PS4
displayName: YOUR_DISPLAY_NAME
}
bf.Progression.getKitRanksMap(params, (error, response) => {
// handle response...
})
Parameters: platform
, personaId
, displayName
, game
Request Route: /Progression/GetMedals
Usage:
const bf = new require('battlefield-stats')(YOUR_API_KEY);
const params = {
platform: bf.Platforms.PC, // also you can use XBOX or PS4
displayName: YOUR_DISPLAY_NAME
}
bf.Progression.getMedals(params, (error, response) => {
// handle response...
})
Parameters: platform
, vehicleId
, personaId
, displayName
, game
Request Route: /Progression/GetVehicle
Usage:
const bf = new require('battlefield-stats')(YOUR_API_KEY);
const params = {
platform: bf.Platforms.PC, // also you can use XBOX or PS4
vehicleId: VEHICLE_ID,
displayName: YOUR_DISPLAY_NAME
}
bf.Progression.getVehicle(params, (error, response) => {
// handle response...
})
Parameters: platform
, personaId
, displayName
, game
Request Route: /Progression/GetVehicles
Usage:
const bf = new require('battlefield-stats')(YOUR_API_KEY);
const params = {
platform: bf.Platforms.PC, // also you can use XBOX or PS4
displayName: YOUR_DISPLAY_NAME
}
bf.Progression.getVehicles(params, (error, response) => {
// handle response...
})
Parameters: platform
, weaponId
, personaId
, displayName
, game
Request Route: /Progression/GetWeapon
Usage:
const bf = new require('battlefield-stats')(YOUR_API_KEY);
const params = {
platform: bf.Platforms.PC, // also you can use XBOX or PS4
weaponId: WEAPON_ID,
displayName: YOUR_DISPLAY_NAME
}
bf.Progression.getWeapon(params, (error, response) => {
// handle response...
})
Parameters: platform
, personaId
, displayName
, game
Request Route: /Progression/GetWeapons
Usage:
const bf = new require('battlefield-stats')(YOUR_API_KEY);
const params = {
platform: bf.Platforms.PC, // also you can use XBOX or PS4
displayName: YOUR_DISPLAY_NAME
}
bf.Progression.getWeapons(params, (error, response) => {
// handle response...
})
Parameters: platform
, game
Request Route: /Loadout/GetWeapons
Usage:
const bf = new require('battlefield-stats')(YOUR_API_KEY);
const params = {
platform: bf.Platforms.PC, // also you can use XBOX or PS4
}
bf.Loadout.getWeapons(params, (error, response) => {
// handle response...
})
Parameters: platform
, game
Request Route: /Loadout/getItemGates
Usage:
const bf = new require('battlefield-stats')(YOUR_API_KEY);
const params = {
platform: bf.Platforms.PC, // also you can use XBOX or PS4
}
bf.Loadout.getItemGates(params, (error, response) => {
// handle response...
})
Parameters: platform
, personaId
, displayName
, game
Request Route: /Loadout/GetPresets
Usage:
const bf = new require('battlefield-stats')(YOUR_API_KEY);
const params = {
platform: bf.Platforms.PS4, // also you can use XBOX or PC
displayName: YOUR_DISPLAY_NAME
}
bf.Loadout.getItemGates(params, (error, response) => {
// handle response...
})
Parameters: platform
, personaId
, displayName
, game
Request Route: /Loadout/GetEquippedDogtags
Usage:
const bf = new require('battlefield-stats')(YOUR_API_KEY);
const params = {
platform: bf.Platforms.PS4, // also you can use XBOX or PC
displayName: YOUR_DISPLAY_NAME
}
bf.Loadout.getEquippedDogtags(params, (error, response) => {
// handle response...
})
Parameters: platform
, game
Request Route: /quick-server-info
Usage:
const bf = new require('battlefield-stats')(YOUR_API_KEY);
const params = {
platform: bf.Platforms.PS4, // also you can use XBOX or PS4
game: 'tunguska' // default is tunguska, can be changed to bf4
}
bf.Server.quickServerInfo(params, (error, response) => {
// handle response...
})
FAQs
A node api for collection and analysis of battlefield 1 and battlefield 4 statistics.
The npm package battlefield-stats receives a total of 34 weekly downloads. As such, battlefield-stats popularity was classified as not popular.
We found that battlefield-stats demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.