Unable to parse response from Update row CURL request on Smartsheet 2.0 API
Using Smartsheet 2.0 APi sto update smartsheets using CURL in my application. The request is
Request Header = PUT /2.0/sheets/6988860577081220/rows?allowPartialSuccess=false HTTP/1.1 Authorization: Bearer XXXXXXXXX
Host: api.smartsheet.com Content-Type: application/json
data to be sent:
{"id":2222,"cells":[{"columnId":33333,"value":"Offline","displayValue":"Offline"}
]}
Response.ContentString =
HTTP/1.1 200 OK Date: Fri, 03 May 2019 12:40:33 GMT Cache-Control: no-cache, no-store, must-revalidate Pragma: no-cache Expires: 0 Content-Type: application/json;charset=UTF-8 Content-Length: 882 Vary: Accept-Encoding {"message":"SUCCESS","resultCode":0,"result":[{"id":2222,"rowNumber":1,"expanded":true,"createdAt":"2018-10-15T08:19:33Z","modifiedAt":"2019-05-03T12:40:34Z","cells":[{"columnId":33333,"value":"Offline","displayValue":"Offline"}
]}],"version":1615}
The above response is not a valid json. Pleae suggest if i am doing something wrong
Comments
-
The response contains a SUCCESS message from the Smartsheet API, so this looks to be going through. have you checked in the sheet to see if the change is happening as expected?
The Smartsheet API only accepts JSON for the data in requests to update cell values. If the sheet is being updated as expected I would think your request is working, but something in how your version of cURL is handling the response data isn't working.
Have you tried making the request using a REST Client like Postman to see if the error persists? This would help differentiate if this is due to some issue with your installation of cURL or not.
-
The changes are happening on my sheet. however, I need to programaticaly acknowledge the success/failure response. However, the response is not a formatted JSON. I
t works well with Advanced Rest Client. However, when I am using same request through C# REST API the response contentstring is merged with HTTP response headers.
All other API except the Update row, like for Create Sheet/Add row/ Delete row are returning a formatted json response with correct response headers. I am using a common method to make request and read response by passing the different request URL to the method.
Response.Header is : HTTP/1.1 100 Continue
Response.Chunked = false;
Response.ContentString is as below:
HTTP/1.1 200 OK
Date: Mon, 06 May 2019 05:35:01 GMT
Cache-Control: no-cache, no-store, must-revalidate
Pragma: no-cache
Expires: 0
Content-Type: application/json;charset=UTF-8
Content-Length: 556
Vary: Accept-Encoding{"message":"SUCCESS","resultCode":0,"result":[.....]}
-
Can you confirm, are you using our C# SDK to make these requests? It is found here:
https://github.com/smartsheet-platform/smartsheet-csharp-sdk
If you are using it, can you confirm you are on the latest version, 2.6.0, of the SDK?
-
No. I am only making REST API calls and reading the HTTP response. We have a limitation at the moment to use any 3rd party SDKs.
-
Aha, I see. The Smartsheet API sends all responses back as JSON. This issue sounds like it is on the client making the request to update the rows and how the response is handled. Have you looked into what code you have written to make the requests and see how it might be different in some cases?
I would strongly suggest using our SDK as it handles all of this for making requests to the Smartsheet API.
-
Will the libraries be compatible for WINCE platform?
for now I am not able to test them on my device due to some signing issues. I can request the key once I know framework compatibility.
-
We don't specifically have support for Windows CE. Though we do have it on our roadmap to add support for .NET Core this year and that may help you. What is the use case where you need to work with Windows CE? What kind of devices are you building for?
I would also suggest taking a look into methods of deserializing JSON with your framework to see how you can handle the response coming back from our API.
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 64.1K Get Help
- 414 Global Discussions
- 221 Industry Talk
- 461 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 141 Just for fun
- 58 Community Job Board
- 462 Show & Tell
- 32 Member Spotlight
- 1 SmartStories
- 299 Events
- 38 Webinars
- 7.3K Forum Archives