I am using a JSON string produced from smartsheets with the intention of selecting specific values and adding them to an sql database. Because this is set up by a user the structure of the smartsheet isn't ideal for putting into an SQL database so I am trying to find a way to tell the program to select specific values to put into the database. What the user has done is turned the cells that are to be put into the database green in smartsheets. The JSON file I get back though only shows columnID, type, value, and display value. I'm not sure if this is possible but I was wondering if there was a way to detect if he had selected the color of that cell to be green?
Open to other suggestions too. I was thinking of adding an extra column that says input so I know that that set of columns in that row need to be entered but thought I might see if the above option is viable in smartsheets using the REST API. At the moment this is (basically) my code.
smartsheetToJSON class.
Console.WriteLine("Requesting data from smartsheets");
//This is the GET request component. Depends on what is in the URL as to what you get back.
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create("https://api.smartsheet.com/1.1/sheet/8385518611261316");
httpWebRequest.ContentType = "application/json";
httpWebRequest.Accept = "*/*";
httpWebRequest.Method = "GET";
httpWebRequest.Headers.Add("Authorization", "Bearer " + authorisation);
Console.WriteLine("Reading data to JSON");
HttpWebResponse httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
string responseString = new StreamReader(httpResponse.GetResponseStream()).ReadToEnd();
return responseString;
And this is currently in the static main.
smartsheetToJSON getSheetData = new smartsheetToJSON();
string jsonString = getSheetData.getSheet();
Console.WriteLine("Printing JSON");
JObject rss = JObject.Parse(jsonString);
Console.WriteLine(jsonString);