question

Adrian avatar image
Adrian asked

"Link Steam Id " not available in cloudscript

Hi,

so in my legacy cloudscript I am trying to link an account to steam by doing

 const requestBodySteam = {"PlayFabId": currentPlayerId, "SteamId": steamId};
 const linkResponse = server.LinkSteamId(requestBodySteam);

That should work, since that's a regular server API according to this: link-steam-id but what I actually get is

 TypeError: server.LinkSteamId is not a function

Why is that? Should I just send a regular http request if that's not working?

apisAccount ManagementCloudScript
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

·
Xiao Zha avatar image
Xiao Zha answered

Sorry for the inconvenience, the LinkSteamId API is not included into Leagcy CouldScript, we recommend calling the API in AzureFunction. You may refer to PlayFab CloudScript using Azure Functions - PlayFab | Microsoft Learn to have more information about how to use AzureFunction. Otherwise, you have to send http request manually. And here is the working Leagcy CouldScript you may refer to:

 handlers.HttpTest=function(args,context)
 {
 var url = https://YourTitleId.playfabapi.com/Server/LinkSteamId; // Define the API endpoint URL
            
 // Define the request headers
 var headers = {
     "X-SecretKey": "Your Developer Secret Key" //This is what we pulled from args in previously
 };
            
 //Define data
 var data = {
     "PlayFabId": currentPlayerId,
     "SteamId": args.SteamId,// you need to pass in the SteamId
 };
    
 //Log stuff
 const json_data = JSON.stringify(data);
 var contentType="application/json"
    
 log.debug(`Data: ${json_data}`);
    
     // Make the request
 var reponse=http.request(url, "POST", json_data,contentType,headers);
    
 return {reponse}
    
 }
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.