Sign In Register

How can we help you today?

Start a new topic
Answered

can I mass-import virtual goods definitions?

I'd like to manage a few hundred virtual goods (cards, upgrades, etc), so it'd be really nice to be able to import all that data as JSON.  Is there a way to do that?


Best Answer
Hey Rich,

Sorry, it is currently not possible to import lists of virtual goods into your game.

Sean

 


Answer
Hey Rich,

Sorry, it is currently not possible to import lists of virtual goods into your game.

Sean

 

Got it.  I think I'll just use a few virtual goods then, and use collections to store the different types of cards.  I was thinking of storing each card as a virtual good, but I think that's gonna be a pain without being able to mass-import.  Thanks for the response!

Hey Rich,

It is something we are looking into, but there is no eta on it yet.

 

if you really want that i created a basic http client on C#. I'll send you the method i am using to accomplish that.

   

        async Task<HttpResponseMessage> VirtualGoodRequest(string Destination, HttpContent Content)
        {
            await login();
            foreach (var item in temp)
            {
                client.DefaultRequestHeaders.Add(item.Key, item.Value);
            }
            client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));

            HttpResponseMessage messge = await client.PostAsync(Destination, Content);
            string description = string.Empty;
            if (messge.IsSuccessStatusCode)
            {
                string result = messge.Content.ReadAsStringAsync().Result;
                description = result;
            }
            return messge;
        } 

public async Task<HttpResponseMessage> AddVirtualGoodRequest(string shortCode, string name, string description, string currency1Cost = null, string currency2Cost = null, string currency3Cost = null,
            string currency4Cost = null, string currency5Cost = null, string currency6Cost = null, string iosAppstoreProductId = null, string googlePlayProductId = null,
            string wP8StoreProductId = null, string w8StoreProductId = null, string amazonStoreProductId = null, string maxQuantitiy = null, string tags = null, string id = null,
            string Tag = null, string propertySetShortCode = null, string segment = "[]")
        {
            var cont = new StringContent("{\"shortCode\":" + ((shortCode == null) ? "null" : "\"" + shortCode + "\"") + ",\"id\":null,\"name\":" + ((name == null) ? "null" : "\"" + name + "\"") + ",\"description\":"
                + ((description == null) ? "null" : "\"" + description + "\"") + ",\"currency1Cost\":" + ((currency1Cost == null) ? "null" : "\"" + currency1Cost + "\"") + ",\"currency2Cost\":"
                + ((currency2Cost == null) ? "null" : "\"" + currency2Cost + "\"") + ",\"currency3Cost\":" + ((currency3Cost == null) ? "null" : "\"" + currency3Cost + "\"") + ",\"currency4Cost\":"
                + ((currency4Cost == null) ? "null" : "\"" + currency4Cost + "\"") + ",\"currency5Cost\":" + ((currency5Cost == null) ? "null" : "\"" + currency5Cost + "\"") + ",\"currency6Cost\":"
                + ((currency6Cost == null) ? "null" : "\"" + currency6Cost + "\"") + ",\"iosAppStoreProductId\":" + ((iosAppstoreProductId == null) ? "null" : "\"" + iosAppstoreProductId + "\"")
                + ",\"googlePlayProductId\":" + ((googlePlayProductId == null) ? "null" : "\"" + googlePlayProductId + "\"") + ",\"wP8StoreProductId\":"
                + ((wP8StoreProductId == null) ? "null" : "\"" + wP8StoreProductId + "\"") + ",\"w8StoreProductId\":" + ((w8StoreProductId == null) ? "null" : "\"" + w8StoreProductId + "\"")
                + ",\"amazonStoreProductId\":" + ((amazonStoreProductId == null) ? "null" : "\"" + amazonStoreProductId + "\"")
                + ",\"maxQuantity\":" + ((maxQuantitiy == null) ? "null" : "\"" + maxQuantitiy + "\"") + ",\"tags\":" + ((Tag == null) ? "null" : "\"" + Tag + "\"") +
                ",\"type\":\"VGOOD\",\"propertySetShortCode\":" + ((propertySetShortCode == null) ? "null" : "\"" + propertySetShortCode + "\"")
                + ",\"segment\":\"" + segment + "\",\"_csrf\":\"" + token + "\"}");
            return await VirtualGoodRequest("https://portal.gamesparks.net/game/294321/virtualgood/", cont);
        }

   you use it like

 

AddVirtualGoodRequest("testff", "testff", "testdesc", googlePlayProductId: "com.google.testProject.testff");

 

Login to post a comment