Jump to content

Posting custom fields ?

Recommended Posts

So i'm using Invision community 4.4.10 on the cloud, and am running into a couple issues that i just cannot seem to grasp properly..
*Disclaimer : I don't usually do this kind of work so am jumping in head first and learning as i go 😉 *

So biggest issue that i can't seem to understand : Custom field posting on a license.
Why this is needed : First time user uses their purchased license key, we would like to make our launcher send a value that registers with the key, and saves within the customFields of said licence to help identify the user in future uses. (should note that our launcher is built entirely in c# , and i would prefer to keep it that way.)

Retrieval of the license info is simple, and ezpz with restsharp :

public IRestResponse GetLicense(string licenseKey)
            RestClient client = new RestClient(website);
            var request = new RestRequest("/api/nexus/lkey/" + licenseKey + apiKey, Method.GET);
            return client.Execute(request);

and to GET the custom fields, i would just load them into a String/String dictionary... But posting the dictionary TO those values has been a tad of a headache. 😣

public IRestResponse PostLicenseFields(string licenseKey)
            var dict = new Dictionary<string, object>
                {"1" , "6666666"},
                {"2" , 0}
            string json = JsonConvert.SerializeObject(dict, Formatting.Indented);
            var request = new RestRequest("/api/nexus/lkey/" + licenseKey + apiKey, Method.POST);
            request.AddParameter("customFields", json);
            return client.Execute(request);

This is what i have tried (among a multitude of other formats including sending a saved .json file, creating a json string from scratch etc etc..) and everything absolutely refuses to update the custom field values. But i can post/delete users, forums and topics no problem using something as simple as

public IRestResponse PostNewMember(string userName, string email, string password, int activation)
            var request = new RestRequest("/api/core/members" + apiKey, Method.POST);
            request.AddParameter("name", userName);
            request.AddParameter("email", email);
            request.AddParameter("password", password);
            request.AddParameter("validated", activation);

            return client.Execute(request);
        public IRestResponse DeleteMemberId(string memberId)
            var request = new RestRequest("/api/core/members/" + memberId + apiKey, Method.DELETE);
            return client.Execute(request);

Am i missing something stupidly obvious.. or just failing hardcore(as is the usual for me 😅)

Thanks for taking the time to read and to any responses 🙂 

Edited by InfinityRazz
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...