Developer

C# Coding Samples

Activate / Validate a License

// https://restsharp.dev/
using System;
using RestSharp;
var client = new RestClient("https://api.keyzy.io/v2/licenses/valid");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n\t\"app_id\": \"your-app-id\",\n \"api_key\": \"your-api-key\",\n \"host_id\": \"host-id\",\n \"serial\": \"the-serial-number\", \n \"code\": \"product-code\",\n \"version\": \"2.0\",\n \"device_tag\": \"device-tag\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);

Activations - Get Activation Objects for a License

// https://restsharp.dev/
using System;
using RestSharp;
var client = new RestClient("https://api.keyzy.io/v2/activations/LICENSE_SERIAL_NUMBER?app_id=YOUR_APP_ID&api_key=YOUR_API_KEY");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);

Activation - Delete an Activation

using System;
using RestSharp;
var client = new RestClient("https://api.keyzy.io/v2/activations/ACTIVATION_ID?app_id=YOUR_APP_ID&api_key=YOUR_API_KEY");
client.Timeout = -1;
var request = new RestRequest(Method.DELETE);
request.AlwaysMultipartFormData = true;
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);

How To Obtain Host ID in Windows Systems

using System;
using Microsoft.Win32;
RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Cryptography");
//if it does exist, retrieve the stored values  
if (key != null)
{
    Console.WriteLine("Device ID: " + key.GetValue("MachineGuid"));
    key.Close();
}