static string CraftApiRequest(FlamingApiRequest apiRequest)
 {
     string rJson = JsonConvert.SerializeObject(apiRequest);
     string j64 = Convert.ToBase64String(rJson.GetBytes());
     return j64;
 }
    static void SendApiRequests()
    {
        Console.Write("Sending Create Profile...");
        string profileName = Guid.NewGuid().ToString("N");
        FlamingApiRequest request = new FlamingApiRequest()
        {
            Action = "CREATE_PROFILE",
            Arguments = new string[] { profileName },
        };
        string jRq = CraftApiRequest(request);
        SendRequest(jRq);
        ReceiveApiResponse();
        Console.WriteLine("Got Response.");

        Console.Write("Sending Write Profile Data...");
        request = new FlamingApiRequest()
        {
            Action = "WRITE_PROFILE_DATA",
            Arguments = new string[] { profileName, "index.txt", "central data" },
        };
        jRq = CraftApiRequest(request);
        SendRequest(jRq);
        ReceiveApiResponse();
        Console.WriteLine("Got Response.");

        Console.Write("Sending Read Profile Data...");
        request = new FlamingApiRequest()
        {
            Action = "READ_PROFILE_DATA",
            Arguments = new string[] { profileName, "index.txt" },
        };
        jRq = CraftApiRequest(request);
        SendRequest(jRq);
        var readResp = ReceiveApiResponse();
        Console.WriteLine(readResp.Arguments[0]);
    }