Get unlimited public & private packages + package-based permissions with npm Pro.Get started »

playfab-sdk

2.47.200518 • Public • Published

NodeSDK README

1. Overview:

Playfab SDK for node.js applications

This SDK includes all PlayFab APIs (Client, Server, Admin) in a single javascript file suitable for using in node.js.

2. Prerequisites:

To connect to the PlayFab service, your machine must be running TLS v1.2 or better.

3. Installation:

The following console command will install the PlayFab NodeSDK. It requires that you have correctly installed node.

npm install playfab-sdk

3b. Example testing project:

The following console command will install the PlayFab NodeSDK example automated-testing project. It requires that you have correctly installed node.

npm install playfab-testing

To run the test, you need to create a testTitleData.json file, explained below. You can place that file in the root of the example beside PlayFabApiTests.ts, or set the full-path location in an environment variable:

set PF_TEST_TITLE_DATA_JSON="C:/YOUR_PATH/testTitleData.json";

Replace "C:/YOUR_PATH" with the location of your testTitleData.json file.

4. testTitleData.json file required for example unit-test-project

This sdk includes an optional example project that is used by PlayFab to verify sdk features are fully functional.

Please read about the testTitleData.json format, and purpose here:

5. Usage Instructions:

Please read our Node Getting Started Guide for step by step instructions on how to set up a Node environment using our PlayFab NodeSDK.

Below an older guide with less detail:

var PlayFabClient = require('./Scripts/PlayFab/PlayFabClient.js')
 
PlayFabClient.settings.titleId = "F00";
 
PlayFabClient.GetTitleData({Keys : ["Sample"]}, function(error, result)
{
    if(error)
    {
        console.log("Got an error: ",error);
        return;
    }
 
    console.log("Reply: ",result);
});

Use similar steps to gain access to the PlayFabServer, PlayFabAdmin, and PlayFabMatchmaker APIs. Additionally, you will need to set your developerSecretKey. For security reasons you must never expose this value to players.

PlayFabClient.settings.developerSecretKey = "your secret key";

You can find your titleId and developerSecretKey in the Game Manager -> Settings -> Credentials section for your title: https://developer.playfab.com/en-us/studios

6. Troubleshooting:

For a complete list of available APIs, check out the online documentation.

Contact Us

We love to hear from our developer community! Do you have ideas on how we can make our products and services better?

Our Developer Success Team can assist with answering any questions as well as process any feedback you have about PlayFab services.

Forums, Support and Knowledge Base

7. Copyright and Licensing Information:

Apache License -- Version 2.0, January 2004 http://www.apache.org/licenses/

Full details available within the LICENSE file.

Install

npm i playfab-sdk

DownloadsWeekly Downloads

1,506

Version

2.47.200518

License

Apache-2.0

Unpacked Size

1.22 MB

Total Files

42

Last publish

Collaborators

  • avatar
  • avatar