Hi,
I wanted to know if there's any API which I can use to get the status of a file before requesting it to download.
Thanks!
Hi,
I wanted to know if there's any API which I can use to get the status of a file before requesting it to download.
Thanks!
There is an admin API GetContentList that can be used to list all contents of the title and get statistics such as size. If you call this API, it will return a content list which like the following one.
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 { "code": 200, "status": "OK", "data": { "ItemCount": 2, "TotalSize": 13100, "Contents": [ { "Key": "a.jpg", "Size": 13000, "LastModified": "0001-01-01T00:00:00Z" }, { "Key": "subfolder/b.txt", "Size": 100, "LastModified": "0001-01-01T00:00:00Z" } ] } }
@Sarah Zhang And Can I run this on server side? I read somewhere that Admin API is not supported in cloud code.
I have created a http request in cloud code for getting content list but I'm getting a complete response in Unity but I only want to get the content data part in my response. How can I do that?
handlers.fetchFilesList = function(args,context){ var headers={ "X-SecretKey": "Redacted" }; var body={}; var url = "https://{Redacted}.playfabapi.com/Admin/GetContentList"; var content = JSON.stringify(body); var httpMethod = "post"; var contentType = "application/json"; var response = http.request(url,httpMethod,content,contentType,headers); return {responseContent: response}; }; <br>
Please refer to the following code to get the Contents part of the response.
... var response = JSON.parse(http.request(url,httpMethod,content,contentType,headers)).data.Contents; ...
3 People are following this question.