GetUploadUrlRequest

Returns a secure, time sensitive URL to allow the game to upload a piece of player content to the GameSparks platform.

View interactive version here

Request Parameters

Parameter Required Type Description
uploadData No JSON[] Optional meta data which is stored against the player's uploaded content

Response Parameters

A response containing a time sensitive URL to allow the game to upload a piece of player content to the GameSparks platform

Parameter Type Description
scriptData ScriptData A JSON Map of any data added either to the Request or the Response by your Cloud Code
url string The time sensitive upload URL

Nested types

ScriptData

A collection of arbitrary data that can be added to a message via a Cloud Code script.

Parameter Type Description
myKey string An arbitrary data key
myValue JSON An arbitrary data value.

Code Samples

C#

    using GameSparks.Api;
    using GameSparks.Api.Requests;
    using GameSparks.Api.Responses;
    ...
    new GetUploadUrlRequest()
        .SetUploadData(uploadData)
        .Send((response) => {
        GSData scriptData = response.ScriptData; 
        string url = response.Url; 
        });

ActionScript 3

    import com.gamesparks.*;
    import com.gamesparks.api.requests.*;
    import com.gamesparks.api.responses.*;
    import com.gamesparks.api.types.*;
    ...

    gs.getRequestBuilder()
        .createGetUploadUrlRequest()
        .setUploadData(uploadData)
        .send(function(response:com.gamesparks.api.responses.GetUploadUrlResponse):void {
        var scriptData:ScriptData = response.getScriptData(); 
        var url:String = response.getUrl(); 
        });

Objective-C

    #import "GS.h"
    #import "GSAPI.h"
    ...
    GSGetUploadUrlRequest* request = [[GSGetUploadUrlRequest alloc] init];
    [request setUploadData:uploadData;
    [request setCallback:^ (GSGetUploadUrlResponse* response) {
    NSDictionary* scriptData = [response getScriptData]; 
    NSString* url = [response getUrl]; 
    }];
    [gs send:request];

C++


    #include <GameSparks/generated/GSRequests.h>
    using namespace GameSparks::Core;
    using namespace GameSparks::Api::Responses;
    using namespace GameSparks::Api::Requests;
    ...

    void GetUploadUrlRequest_Response(GS& gsInstance, const GetUploadUrlResponse& response) {
    GSData scriptData = response.getScriptData(); 
    gsstl::string url = response.getUrl(); 
    }
    ......

    GetUploadUrlRequest request(gsInstance);
    request.SetUploadData(uploadData)
    request.Send(GetUploadUrlRequest_Response);

Java

import com.gamesparks.sdk.api.autogen.GSRequestBuilder.GetUploadUrlRequest;
import com.gamesparks.sdk.api.autogen.GSResponseBuilder.GetUploadUrlResponse;
import com.gamesparks.sdk.api.autogen.GSTypes.*;
import com.gamesparks.sdk.api.GSEventListener;

...
gs.getRequestBuilder().createGetUploadUrlRequest()
    .setUploadData(uploadData)
    .send(new GSEventListener<GetUploadUrlResponse>() {
        @Override
        public void onEvent(GetUploadUrlResponse response) {
            GSData scriptData = response.getScriptData(); 
            String url = response.getUrl(); 
        }
    });

Cloud Code


    var request = new SparkRequests.GetUploadUrlRequest();
    request.uploadData = ...;
    var response = request.Send();

var scriptData = response.scriptData; 
var url = response.url; 
Did this page help you? Please enter your feedback below. For questions about using this part of the platform, please contact support here