question

emergingtech786 avatar image
emergingtech786 asked

Hello Guys I am using javascript to get playerstatistics but cannot find the porper syntax for it can you please help?

Hello Guys, I am using playerstatistics in my unity Game. I also want to make a website on which player can login and see his statistics and update them. The issue is to get playerstatistics through javascript and updating them But I cannot get the proper syntax can you help me please?

Apparently There is an error while using PlayFabClientSDK.UpdatePlayerStatistics;
This is my Code


function loginWithPlayfab(accessToken) {

PlayFabClientSDK.LoginWithFacebook(

{

AccessToken: accessToken,

TitleId: "A4718",

CreateAccount: false,

}

, onPlayFabResponse

);

} /

/ Handles response from playfab.

function onPlayFabResponse(response, error) {

if (response)

GetPlayerXp()

logLine("Response: " + JSON.stringify(response));

if (error) logLine("Error: " + JSON.stringify(error));

}

function GetPlayerXp()

{

PlayFabClientSDK.GetPlayerStatistics({
StatisticNames:"money",
},getPlayerStatisticCallback);

var getPlayerStatisticCallback = function (result, error) {
console.log(result);
};

}

It says that PlayFabClientSDK

{"code":400,"status":"BadRequest","error":"InvalidAPIEndpoint","errorCode":1131,"errorMessage":"The URL for this request is not valid for this title. The correct API endpoint is https://a4718.playfabapi.com/"}

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Rick Chen avatar image
Rick Chen answered

I have done a test but I cannot reproduce the issue you described. This issue generally means that the endpoint of your API call is incorrectly set. Could you please describe how you set the titleId? Did you follow this document: https://docs.microsoft.com/en-gb/gaming/playfab/sdks/javascript/quickstart to set up the titleId?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.