Sign In Register

How can we help you today?

Start a new topic
Answered

Import Cloud Code using REST API

Does anyone know how to use the import methods in the cloud API?


I've been trying to update the code via cUrl.  So far I have:

curl -X POST --header "Content-Type: application/x-www-form-urlencoded" --header "Accept: application/json" --header "Authorization: Basic {base64authStr}" -d "file=@gs_cloud_code.zip" "https://config-beta.gamesparks.net/restv2/game/{apiKey}/admin/scripts/import/preview"

I get this response:

{"message":"The current request is not a correct multipart request"}

I've tried changing this in various ways (using -F instead of -d, using multipart/form-data, and so on). I always get the same response.


Can anyone give an example of how to use this part of the API to update cloud code?


Best Answer

Hi Mark,


Our interactive REST API documentation page should be able to help you. You can find it here. Once you have entered your details you can test the calls. You'll get a URL and a Curl example once you have sent your request. Try that out and if you have any further questions just let us know.


Regards,

Liam


1 person has this question

Answer

Hi Mark,


Our interactive REST API documentation page should be able to help you. You can find it here. Once you have entered your details you can test the calls. You'll get a URL and a Curl example once you have sent your request. Try that out and if you have any further questions just let us know.


Regards,

Liam

Hello Liam,


That's page where I copied the query from. Even when I test on that page I get exactly the same error message. I haven't figured out how to get this particular request to work.


Thanks

Mark

Hi Mark,


Can you let me know the name of the game and the script you are trying to update ? Can you show me what you are using in the body of the request here ?


Thanks,

Liam

Hello,


The game is called Star Explorer - I'm trying to update all scripts using a zip file. I assumed this was the way as it matches the interface in the website.


Thanks

Mark

Hi Mark,


Yes you can do it this way with a game admin REST call. You can find it here. If you need any help just let us know.


Regards,

Liam

Hello,


This is where I've been trying to do it, but it is failing on that page as well.


Thanks

Mark


1 person likes this

I am also facing the same problem. A bit of insight would be of great help.


1 person likes this

Hi, I'm also trying the Game admin REST call and it's working there but when I tried Postman I can't work it out. Shows this error:

{

    "errorCode": "bad_request",

    "message": "The current request is not a correct multipart request"

}

Hi Desiree,


Try it using my config below. I'm only specifying the basic auth in the header here.


//form data

image


//headers

image


This works as expected for me. Can you try that and let me know how you get on please ? 


Regards,

Liam

Login to post a comment