question

Teodor Plop avatar image
Teodor Plop asked

http merge requests

Hi there!

These days I'm trying to implement most of the features needed for our new game and I want to apologize for having so many questions, hehe.

After some troubleshooting, I managed to send GET, POST and PUT requests successfully to Azure Table Storage. I ran into a problem with MERGE requests, which are quite useful to update single properties from our tables: https://docs.microsoft.com/en-us/rest/api/storageservices/merge-entity

The error I'm getting is "Content-Type header value missing.". I tried setting Content-Type both manually in a header, and automatically using the argument provided by http.request, it's still the same.

My first guess would be that Playfab http API won't set the Content-Type header unless the request is POST or PUT... And we need that for MERGE as well (it's just a guess). Can you help me with this?

Cheers!

10 |1200

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

Sarah Zhang avatar image
Sarah Zhang answered

[Updated] PlayFab CloudScript hasn't yet supported this REST method "merge". Apologies for the confusion. Currently, PlayFab provides this feature -- CloudScript using Azure Functions. And Azure Functions can be used with Azure table storage as this doc says. Please visit the corresponding documentation for more information.

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.

Teodor Plop avatar image Teodor Plop commented ·

Hi!

Yes, I used the exact format as the one they describe in their sample request and response. My error is "Content-Type header value missing.", even though I tried multiple methods (of setting it inside the http.request parameter or inside my custom headers).

I know that cloud script is compiled using v8 (I read that on another question related to http.request), but the http.request function is a custom Playfab function, not plain Javascript. And since we have to specify the contentType as a separate argument from the headers, I guess it does something special with it.

We can use a combination of GET and PUT (which work perfectly fine with http.request) in order to obtain the same results as MERGE, but it's not that great since we have to use two requests instead of one, and we also have to exchange more data with the table storage. So we would really appreciate if we can get this to work somehow.

Cheers!

0 Likes 0 ·
Marius Badita avatar image Marius Badita commented ·

thank you Sarah. I'll try out this new feature next week. cheers!

0 Likes 0 ·
Marius Badita avatar image
Marius Badita answered

Hi guys, any news on this? I've been using Sarah's links and built my headers exactly like in the samples.

"Headers": { "Accept": "application/json", "x-ms-version": "2018-03-28", "x-ms-date": "Tue, 02 Jun 2020 10:30:01 GMT", "DataServiceVersion": "3.0;NetFx", "MaxDataServiceVersion": "3.0;NetFx", "Authorization": "SharedKeyLite <removed>", "Content-Type": "application/json", "Content-Length": 1 }

Like Teodor said, the Put and Get methods are working, but merge isn't. Maybe this is post-processed by you in someway ?

1 comment
10 |1200

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

Marius Badita avatar image Marius Badita commented ·

So, even thoough the Content-Type is clearly in the headers, i still get "Content-Type header value missing."

0 Likes 0 ·
simon-2 avatar image
simon-2 answered

I'm also getting the same issues. I've tested successfully within postman, but using the exact same request settings fails in CloudScript with the missing Content-Type header. It would appear the http library used within CloudScript simply doesn't support custom http request types like MERGE. A work around is to perform a 'GET' to retrieve the full object first, then update the fields you need and do a 'PUT' but this is not ideal as it increases request count and data transferred.

10 |1200

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

Sarah Zhang avatar image
Sarah Zhang answered

@Teodor Plop @Marius Badita @simon-2 PlayFab CloudScript hasn't yet supported this method "merge". Apologies for the confusion. Currently, PlayFab provides this feature -- CloudScript using Azure Functions. And Azure Functions can be used with Azure table storage as this doc says. Please visit the corresponding documentation for more information, thanks.

Besides, if using the Azure table storage service in the PlayFab CloudScript is necessary for you, you can try to add a feature request for it.

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.