public void SetNewRows(string table, Row[] rows)
        {
            string falseRowKey = Guid.NewGuid().ToString();
            string postUrl= string.Format("{0}/{1}",table,falseRowKey);


            CellSet c = new CellSet();
            c.Rows = rows;

            //encode fields to Base64
            foreach (var row in c.Rows)
            {
                row.Key = row.Key.EncodeToBase64();

                foreach (var cell in row.Cells)
                {
                    cell.Column = cell.Column.EncodeToBase64();
                    cell.Value = cell.Value.EncodeToBase64();
                   //cell.Timestamp = DateTime.Now.ToUnixTimestamp();
                }
            }

            string cellSetJson = Serializers.ToJson<CellSet>(c);
            /*
            {"Row":[{"key":"bG9naW43","Cell":[{"column":"aW5mbzpuYW1l","$":"bG9naW43","timestamp":1262170650}]}]}
            {"Row":[{"key":"bG9naW41","Cell":[{"timestamp":1262165074260,"column":"aW5mbzpuYW1l","$":"bG9naW41"}]}]}
             */
            var hc = HttpContent.Create(cellSetJson);
            

            var response= stargateHttpClient.Post(postUrl, "application/json",hc);

            response.EnsureStatusIsSuccessful();
        }
Example #2
0
        private static void SetRowsViaStargate()
        {
            Row[] rows = new Row[]{
                new Row(){ 
                    Key="login9", 
                    Cells=new CellList(){
                        new Cell(){ Column="info:name",Value="login9-"+DateTime.Now.ToString()},
                        new Cell(){ Column="info:email", Value="*****@*****.**"}
                    }
                },
                 new Row(){ 
                    Key="login10", 
                    Cells=new CellList(){
                        new Cell(){ Column="info:name",Value="login10"},
                        new Cell(){ Column="info:email", Value="*****@*****.**"},
                        new Cell(){Column="feeds:eastgroup.pl", Value=DateTime.Now.ToShortDateString()},
                        new Cell(){Column="feeds:feed1.pl/rss", Value=DateTime.Now.ToShortDateString()},
                        new Cell(){Column="feeds:feed2.pl/rss", Value=DateTime.Now.ToShortDateString()},
                    }
                }
                   
            };


            string table = "users";
            client.SetNewRows(table, rows);
        }
 public void SetNewRow(string table, Row row)
 {
     SetNewRows(table, new Row[] { row });
 }