"errorCode" : 1008 | Adding new new row using powershell
I am using powershell to automate smartsheet entries, I am able fetch sheet data but I am facing issues while adding a new row to the smartsheet.
$headers = @{
'Authorization' = 'Bearer <API token>'
'Content-Type' = 'application/json'
}
$body = @{
'columnId ' = '229799331424132'
'value' = 'true'
}
$puturi="https://api.smartsheet.com/2.0/sheets/7647453991200644/rows"
Invoke-RestMethod -Method post -Uri $puturi -Headers $headers -Body $body
using this API reference guide:
ERROR:
Invoke-RestMethod : {
"errorCode" : 1008,
"message" : "Unable to parse request. The following error occurred: Unrecognized token 'value': was expecting ('true', 'false' or 'null')\n at [Source: REST input; line: 1,
column: 7]",
"refId" : "1aipur5vacxtg"
}
At line:1 char:1
Answers
-
Hi @kashif.raza
Is that column a checkbox column? If so, try removing out the quotes from around the True value:
}
$body = @{
'columnId ' = '229799331424132'
'value' = true
}
Let me know if this works for you!
Cheers,
Genevieve
Need more information? 👀 | Help and Learning Center
こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao!👋 | Global Discussions
-
I tried it but but it is not working and surprisingly column is not a checkbox that is a text colume and I tried this also.
$body = @{
'columnId ' = '229799331424132'
'value' = "My text String"
}
-
Hi @kashif.raza
If you're updating a Text/Number cell with a text value via the API, then yes, wrapping it in quotes is the correct syntax.
The error message expecting ('true', 'false' or 'null') sounds to me like the column is expecting a boolean value (e.g. a checkbox column, or flag or star symbol). I'm unable to replicate that error with a Text/Number column.
That said, I am using the API directly and have not worked with PowerShell. I would suggest posting in the Power Shell Tech Community for help with Power Shell syntax.
Thanks!
Genevieve
Need more information? 👀 | Help and Learning Center
こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao!👋 | Global Discussions
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 66K Get Help
- 429 Global Discussions
- 149 Industry Talk
- 488 Announcements
- 5.2K Ideas & Feature Requests
- 85 Brandfolder
- 153 Just for fun
- 74 Community Job Board
- 499 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 305 Events
- 36 Webinars
- 7.3K Forum Archives