@scoutsdk/server-sdk
v0.7.0
Published
Build powerful gaming community apps with magic. Scout delivers gaming stats to apps and websites.
Downloads
106
Maintainers
Readme
Scout is a gaming platform for app developers.
App developers need game stats data and other resources to build engaging apps for popular video games. We provide the data and the resources to do that. With Scout, these apps are better and more powerful, with less work for everyone. It's a win-win-win.
What's it for?
Your use of Scout depends on who you are:
- For app developers, Scout is an easy to use and powerful SDK that gives you access to data and features that were once hard to come by.
- For game developers, Scout is capable of collecting, analysing and storing data from the world's largest AAA titles. Want to know more? Contact us.
We've got some pretty legit features, too.
We know what features people love, so we've put them within reach.
- Real-time statistics and analysis: We thought static data was getting a little stale, so we support pushing real-time updates to player profiles and statistics.
- Global and regional leaderboards: Now apps can support up-to-the-second leader changes with the help of our real-time leaderboard system.
- Session tracking + match history (coming soon!): Sometimes statistic totals don't show the whole story. Show users how they're progressing each time they play.
- User profile information + friends lists (coming soon!): No more asking users for their gamer usernames. When a user visits your site, you'll know who they are automatically.
Turn it into a full-time job.
We love what developers are building, and we want to make it easier to continue pouring love into their projects.
- In-app payments (coming soon!): Our payment flow removes the stress and overhead of enabling in-app payments.
- Ad partnerships: Our ads can be displayed on a website or in an app. Revenue from the ads will be shared with the developer.
Getting Started
Ready to get started? Great! Our full documentation is available here. Below we'll outline the most common setup for a Node.js application and demonstrate how you can start using the SDK.
Install the SDK
First we need to get the SDK from npm.
npm install scout-sdk-server --save
Import and configure
Next you'll want to import the Scout SDK.
import Scout from 'scout-sdk-server';
For this next step you'll need to register an application through our developer dashboard.
Once Scout is imported we need to configure our application to use our client credentials (created during our app registration.)
Note: We're assuming you're in an async context so we can utilize ES7 async/await. You can create an async context by simply wrapping your code in an async function
and invoking the function as a promise.
await Scout.configure({
clientId: 'YOUR CLIENT ID HERE',
clientSecret: 'YOUR CLIENT SECRET HERE',
scope: 'public.read'
});
For now you can leave the scope as is, but you should refer to the documentation to better understand what scope you need to configure for your use.
Making your first call
We're ready to get some data from Scout!
Note your usage will be heavily rate limited while your app is unpublished.
// Lets get Scout's supported games or "titles", note we could also use Scout.titles.get(id)
let titles = await Scout.titles.list();
console.log(titles);
// Fortnite will be returned as one of the available titles, let's find it.
let fortnite = titles.find(t => t.slug === 'fortnite');
// Cool, but that information isn't super useful on its own. Let's use the title ID to search for a player.
// Note that we're using `fortnite.id` here, but we could just as well use the string literal "fortnite", which is Fortnite's `slug`.
// The second argument of the search method is the platform's `slug` -- this comes in handy when a title supports multiple platforms (such as Epic ("PC"), Xbox Live, and Playstation Network). This parameter can be left null, however you will have more success if you always include a value. Our search heuristics can cross reference gamertags and/or PSN IDs if they're in our system.
let search = await Scout.players.search('Ninja', 'epic', fortnite.id);
// Okay, now we have a list of zero or more results. In this case, it's probably an exact match. And we know Ninja plays Fortnite under this username, so we can assume that this search result exists.
let ninjasId = search.results[0].player.playerId;
// Let's get his stats!
let ninja = await Scout.players.get(fortnite.id, ninjasId, 'p9.br.m0.alltime');
console.log(ninja);
You'll notice the last parameter of the Scout.players.get
method is seemingly made up. This is the "segment" of data that we want to see. In most games, player data can be segmented into several distinct profiles. Examples of this are segmenting the player's data by playlist, gametype, region, hero, etc.
We will always return some data if you specify null
as the segment (or just ignore that parameter). Each game's documentation describes each game's segment key structure.
Where to go from here
We'd recommend you take a look at our docs to familiarize yourself with all that Scout has to offer.
Scout also offers monetization strategies for apps and websites. Want to offer in-app purchases on your website or serve ads in your app? We've got you covered.