Sign In Register

How can we help you today?

Start a new topic
Deferred

Create downloadables from REST API

Using Unity3D.
We have defines for each level stored in XML files which we would like to put in downloadables.
That way we can change the levels and even add new ones without it being required for our players to update the game.
Right now for each new level we add, we have to first go to the downloadables section on the portal to create the shortcode and upload the xml there.

We can already update the levels using the REST API, but it would be very helpful if we could create new ones as well from within the Unity Editor.
(Now it returns: "Short code [DEF_LEVEL_2] Unknown" if we try upload a new one).

I can imagine this feature being a great addition for other types of games (like when there's a level editor for players) as well.

Is there already a way to do this?

Thanks in advance.




@Liam I implemented this code into an Asset Bundle system so I can upload them it works fine then I tried to add other people into the project and when they tried it doesn't allow them they get 403 error, looks like this only works with the owner account.


1 person likes this

Hi Hjupter,


Are these users set as gameAdmins in the project ? 


Regards,

Liam

Hi Liam,


Yes they have all access. I tried changing the code to use the rest api here:

https://docs2.gamesparks.com/api-documentation/rest-apis/game-configuration.html#!/game.downloadables/post_restv2_game_apiKey_config_~downloadables_downloadableId_file


But I'm getting this error: 

{"responseCode":-1,"errorMessage":"The remote server returned an error: (500) Server Error."}


I tried using basic authorization and X-GSAccessToken none of them worked,

Hi Liam,


Yes they have all access I even tried myself by creating a new account added it as admin (all access) and I was getting the same error, we wanted to use downloadables feature for asset bundles but this is stopping us.


I tried using the restv2 API but I get this error: The remote server returned an error: (500) Server Error.


 https://docs2.gamesparks.com/api-documentation/rest-apis/game-configuration.html#!/game.downloadables/post_restv2_game_apiKey_config_~downloadables_downloadableId_file
 

I tried basic and GSAccessToken authentication nothing worked.

Hi Hjupter,


Apologies for the delayed response. I've tested this and it works fine for me and collaborators in the game. If you're still having an issue please raise a ticket and we'll investigate this for you.


Regards,

Liam


Hi Liam,


We are still having this issue so we are using Amazon S3 for our asset bundles for now.


1 person likes this

In newer version of GameSparks (v5.6.5.214 or they've changed something on their endpoints) for Unity the method setDownloadable of GameSparksRestApi.cs does not work. After hours trying to figure out what was wrong, it seems that the issue is in GameSparksEditorFormUpload.cs, Line 24: "binaryContentFile" should actually be "file", using the "binaryContentFile" will result in 403 Forbidden with no error message.

Login to post a comment