question

xigmasuji avatar image
xigmasuji asked

How to implement JsonPatching in the AzureServerFunction

We have a player profile structure in the server which is used to generate a player progression storag-system in playfab database, since we do not have this whole structure in the game we would like to change the actual contents of the player's database in the playfab DB using AzureFunction for that we would think something like Json Patching would help where we send what aspect of the JSON we would like to change from the server and it will change only that in the Azure Function and update it in the database, I implemented the Microsoft.AspNetCore.JsonPatch and Microsoft.AspNetCore.Mvc.NewtonsoftJson but unlike in ASP.Net we do not have a Program.cs where you could add the var builder =

 WebApplication.CreateBuilder(args);
    
 builder.Services.AddControllers()
     .AddNewtonsoftJson();

I don't know how to proceed further please help me out with this, also please let me know whether or not JsonPatching is possible in a Azure Function

Thak you

Player DatadataPlayer Inventory
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

What do you mean by “player’s database”? Also, PlayFab does not provide the functionality to communicate directly with PlayFab DB, you can only use the APIs (UpdateUserData, File - REST API (PlayFab Data) | Microsoft Learn, etc.) provided by PlayFab to update the player's data. And these APIs do not support direct modification of part of the data, you need to obtain the complete data first, then modify part of it, and finally update the modified data to playfab DB using the APIs. You may refer to Player Data - PlayFab | Microsoft Learn to have more information about player data.

2 comments
10 |1200

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

xigmasuji avatar image xigmasuji commented ·

Yeah I have done all of that, my question is related to the fact whether or not I can do JSON Patching by using ASP.NET Core plugins using plugins like Microsoft.AspNetCore.JsonPatch because I do not want to update the entire data structure when I can update just the part of it

0 Likes 0 ·
Xiao Zha avatar image Xiao Zha xigmasuji commented ·

No, as I mentioned above, If you want to update just the part of player’s data (Player Data and Entity File, etc.), you can only use APIs which provided by PlayFab to update these data, and these APIs for updating data do not support modifying parts of data directly.

0 Likes 0 ·

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.