question

brendan avatar image
brendan asked

GetContentUploadURL question

Andrei.cibotaru
started a topic on Sun, 06 September 2015 at 9:18 AM

Hi,

I am trying to use the GetContentUploadURL API to upload a asset bundle. The problem is when i try to upload the file I get the following error when i run curl:

The request signature we calculated does not match the signature you provided. Check your key and signing method.

I've double checked the App Secret key and the Title id and it seems I cannot get it to work.

I've used this page as reference https://playfab.com/blog/how-use-playfabs-content-management-api/

Kind regards,

Andrei

10 |1200

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

brendan avatar image
brendan answered

Best Answer
Brendan Vanous said on Mon, 07 September 2015 at 1:27 AM

Hi again,

I see, thanks. The Content Type I would recommend is indeed application/octet-stream. However, to specify this in the call to GetContentUploadUrl, you need to make the call like so:

curl -XPOST https://[myTitleID].playfabapi.com/admin/GetContentUploadUrl 

-H "Content-Type: application/json" 

-H "X-SecretKey: [appSecretKey]]" 

-d "{'ContentType' : 'application/octet-stream', 'Key' : 'application/assetBundle'}"

Could you give that a try?

Brendan


6 Comments
Brendan Vanous said on Sun, 06 September 2015 at 2:59 PM

Hi Andrei,

That's most commonly caused by a mis-match in the Content Type. The API call has a "ContentType" parameter, which needs to match the "Content-Type" header you specify in the upload. What's the file type, and what are you specifying in the calls?

Brendan


Andrei.cibotaru said on Mon, 07 September 2015 at 12:54 AM

Hi Brendan,

Thank you for the quick reply. I tried application/octet-stream since my file is an unity asset bundle. I also tried different content-types such as image just to try to get it working.

Here are the curl commands I've used:

curl -XPOST https://[myTitleID].playfabapi.com/admin/GetContentUploadUrl 

-H "Content-Type: application/json" 

-H "X-SecretKey: [appSecretKey]]" 

-d "{'Key' : 'application/assetBundle'}"

curl -v --insecure -H "Content-Type:application/octet-stream" --upload-file "assetBundle" "[url received from GetContentUploadURL]?

Kind regards,

Andrei


Brendan Vanous said on Mon, 07 September 2015 at 1:27 AM

Hi again,

I see, thanks. The Content Type I would recommend is indeed application/octet-stream. However, to specify this in the call to GetContentUploadUrl, you need to make the call like so:

curl -XPOST https://[myTitleID].playfabapi.com/admin/GetContentUploadUrl 

-H "Content-Type: application/json" 

-H "X-SecretKey: [appSecretKey]]" 

-d "{'ContentType' : 'application/octet-stream', 'Key' : 'application/assetBundle'}"

Could you give that a try?

Brendan


Andrei.cibotaru said on Mon, 07 September 2015 at 1:33 AM

Hi Brendan,

Indeed your solution works. Thanks a lot for your help.

Kind regards,

Andrei


Andrei.cibotaru said on Thu, 10 September 2015 at 8:52 AM

Hi,

I have one more question. I've been testing this feature with some files. At some point I have removed the files from the server using the DeleteContent call. Still my applications find the old files, download them and use them. Are these files cached on the server? If yes, for how long.

Kind regards,

Andrei


Brendan Vanous said on Thu, 10 September 2015 at 10:34 PM

Yes, the Content cache time is one hour.

Brendan

10 |1200

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

Andrei Cibotaru avatar image
Andrei Cibotaru answered

Hello again,

Is it possible to overwrite a file stored on the server?

Kind regards,
Andrei

10 |1200

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

brendan avatar image
brendan answered

Yes, uploading content with the same Key will overwrite the existing file. You can also use the Admin/DeleteContent method to remove unwanted content files.

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.