question

tldQuantic avatar image
tldQuantic asked

How to Upload and Download a file with the C++ SDK?

Hi,

I am reading the following documentation: https://docs.microsoft.com/fr-fr/gaming/playfab/features/data/playerdata/entity-files

But I cannot find in the C++ SDK the equivalent of these two C# functions used in your sample:

PlayFabHttp.SimplePutCall and PlayFabHttp.SimpleGetCall

It seems I cannot make a WinHttpOpenRequest function call with GET and PUT HttpMethod.

In your function:

void PlayFabWinHttpPlugin::ExecuteRequest(std::unique_ptr<CallRequestContainer> requestContainer)

...

hRequest = WinHttpOpenRequest(hConnect, L"POST", urlComponents.lpszUrlPath, NULL, WINHTTP_NO_REFERER, NULL, winHttpOpenRequestFlags);

So I created a Cloudscript function to make a http request and it works fine but I want to know how to do this directly by usign your C++ SDK.


Thanks in advance for your help.

apissdksdataContent
10 |1200

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

Citrus Yan avatar image
Citrus Yan answered

The PlayFabHttp.SimplePutCall and PlayFabHttp.SimpleGetCall method are from the UnitySDK, which you can find the definition in here:

PlayFabHttp.SimplePutCall

PlayFabHttp.SimpleGetCall

However, referring to the C++ SDK, looks like it does not natively support making Get/Put http requests, hence, to make Get/Put requests in your C++ project, you might want to consider implementing this feature yourself, and, you may find this C# implementation helpful: SimplePutCall.

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.

tldQuantic avatar image tldQuantic commented ·

Ok, thanks for your answer.

For many reasons, I don't want to make any changes in the source code of the C++ SDK.
So I just checked the code and I think the best way to do it is to implement my own version of the HttpPlugin for all platforms and provide them to the PlayFabPluginManager via the SetPlugin function.

What do you think of this workaround?

But in my opinion, it would be much easier for all the users of your C++ SDK to provide an HttpPlugin with GET and PUT http methods as you did it in your Unity SDK.

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan tldQuantic commented ·

Sounds great to me! And, about providing a HttpPlugin with GET and PUT http methods in the C++ SDK, please make a feature request to help us improve the service here:

https://community.playfab.com/spaces/24/index.html

The more information we have on the needs of our developer community, the better we are able to prioritize our work, again, thanks for your feedback!

1 Like 1 ·
tldQuantic avatar image
tldQuantic answered

Ok, thanks for your help.


I will make a feature request about this topic.

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.