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/"}
Answer by Junjin Chen · 6 days ago
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?