How can I a single cells value using API?

I have the below code, I am trying to get the value a specific cell but I am getting the 1006 error. However if I modify this for a put request, it works without issue? also to note, I am doing this in vb
ย ย Sub GetCompletedCellValue(apiKey As String, sheetId As Long, rowId As Long, columnId As Long)
ย ย ย ย Using client As New HttpClient()
ย ย ย ย ย ย client.DefaultRequestHeaders.Authorization = New AuthenticationHeaderValue("Bearer", apiKey)
ย ย ย ย ย ย Dim getResponse As HttpResponseMessage = client.GetAsync($"https://api.smartsheet.com/2.0/sheets/{sheetId}/rows/{rowId}/cells/{columnId}").Result
ย ย ย ย ย ย If getResponse.IsSuccessStatusCode Then
ย ย ย ย ย ย ย ย Dim responseContent As String = getResponse.Content.ReadAsStringAsync().Result
ย ย ย ย ย ย ย ย Dim cellData As JObject = JObject.Parse(responseContent)
ย ย ย ย ย ย ย ย Dim cellValue As String = cellData("value").ToString()
ย ย ย ย ย ย ย ย Debug.WriteLine("Current cell value: " & cellValue)
ย ย ย ย ย ย Else
ย ย ย ย ย ย ย ย Debug.WriteLine($"Error getting cell value: {getResponse.Content.ReadAsStringAsync().Result}")
ย ย ย ย ย ย End If
ย ย ย ย End Using
ย ย End Sub
Answers
-
Hey @CHIRS GOLPHIN
I'm not familiar with VB, however I would suggest if you're using GET to GET the entire row.
https://api.smartsheet.com/2.0/sheets/{sheetId}/rows/{rowId}
Then you can loop through the Cells array that is returned for the row to find the column and cell data you're looking for. Here's the API Docs for Get Row: https://smartsheet.redoc.ly/tag/rows#operation/row-get
Cheers,
Genevieve
Need more information? ๐ | Help and Learning Center
ใใใซใกใฏ (Konnichiwa), Hallo, Hola, Bonjour, Olรก, Ciao!๐ | Global Discussions