Curl GET request mixed results
Hello community,
Just getting started and trying to leverage Curl to proof a few things out. When I issue the following example command, I get a list of my sheets successfully:
curl -X GET -H "Authorization: Bearer " "https://api.smartsheet.com/2.0/sheets"
When I issue a more specific command listing one of the sheet ID's returned in the above results:
curl -X GET -H "Authorization: Bearer XXXXXXXXXXXX" "https://api.smartsheet.com/2.0/sheets/6141831453927300"
I get the following error:
{
"errorCode" : 1004,
"message" : "You are not authorized to perform this action.",
"refId" : "1w34sp5pw1k00"
}
I was trying to add a column to a sheet I owned and it gave me the same error, so I started with the simplest command and built upon it to find out when this error occurred. Hopefully it is something simple I am missing.
Many thanks in advance.
-Mike
Comments
-
Hi Mike,
Looks like the endpoint you're using to add columns is this:
https://api.smartsheet.com/2.0/sheets/{sheetId}
The endpoint for add column is:
https://api.smartsheet.com/2.0/sheets/{sheetId}/columns
Try adding the /columns to your endpoint in your request. If that doesn't work, make absolutely sure that your auth token is coming from your account. (You might generate a new token to test.) Also make sure that the sheet Id is a sheet that you own or have Admin permissions on (assuming you have a license).
You can use the API to check your sharing permissions level on the ID you're trying to call: https://smartsheet-platform.github.io/api-docs/?shell#get-sheet-share
More info on the add columns cURL request can be found here: https://smartsheet-platform.github.io/api-docs/?shell#add-columns
-
Thanks for looking into this Shaine. I am still getting the permission issue. I am the owner, but it let me qury the sheet without issue and id sees that I am the owner. I tried creating a new workspace and moving it into there and same result. I also tried accessing another sheet where I just have Admin and still the same error. As a last effort, I replaced my token and tried again. Still get the permissions error.
-Mike
-
Mike a few things to confirm here:
- Confirm that you're using the /columns with your endpoint.
Your original code just has /sheets/<sheet id>
It needs the /columns if you're going to try and add a column.
- Also make sure that you're not performing a GET request when trying to add a column. Adding a column is a POST request, so you'll want to use -X POST instead of -X GET
- Please also confirm that you're generating an API token from the same account that owns the sheet.
If the above doesn't work, try this:
- Create a brand new sheet
- Get the sheet ID of that new sheet
- Try performing the same requests with your code
Otherwise, if you're still experiencing issues—reach out to our Support team and they can further assist.
- Confirm that you're using the /columns with your endpoint.
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 64.2K Get Help
- 419 Global Discussions
- 221 Industry Talk
- 461 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 142 Just for fun
- 58 Community Job Board
- 462 Show & Tell
- 32 Member Spotlight
- 1 SmartStories
- 299 Events
- 38 Webinars
- 7.3K Forum Archives