question

shinnosukehashimoto avatar image
shinnosukehashimoto asked

How to get PlayFabId in CloudScript(using AzureFunctions)

I would like to use CloudScript (using AzureFunctions) to update user data for all users.

I would like to use the following method,

https://learn.microsoft.com/en-us/rest/api/playfab/server/player-data-management/update-user-data?view=playfab-rest

How do I get the PlayFabId of the request?

We would like to execute CloudScript at any given time by using the Scheduled Tasks feature.

apisCloudScriptscheduled tasks
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

·
Gosen Gao avatar image
Gosen Gao answered

To access the PlayFabId in an Azure Function triggered by a Scheduled Task, you can refer to Use the context model when executing in the context of a Player. And here is the code you can refer to:

 PlayerPlayStreamFunctionExecutionContext<dynamic> context = JsonConvert.DeserializeObject<PlayerPlayStreamFunctionExecutionContext<dynamic>>(await req.ReadAsStringAsync());
 var playfabId = context.PlayerProfile.PlayerId;
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.