Adding Sheet to Report using API

Michael.Limanni
edited 05/03/24 in API & Developers

After some trouble with this command line string. I am getting a 1006 error even though I am the Owner of the Report and Owner of the Sheet that I am trying to insert. I can do this manually without any issues. Any thoughts?

curl -H "Authorization: Bearer TOKENHERE" -H "Content-Type: application/json" -X POST "https://api.smartsheet.com/2.0/reports/REPORDIDhere/sheets" -d '{"sheetId":"SheetIDhere"}'

I get:

{
"errorCode" : 1006,
"message" : "Not Found",
"refId" : "u9yqdu"
}

Answers

  • Also give same error when I try this way in PowerShell:

    $reportId = "1234567890"
    $sheetIdToAdd = "0987654321"
    $accessToken = "MYTOKENISHERE"

    $headers = @{
    "Authorization" = "Bearer $accessToken"
    "Content-Type" = "application/json"
    }

    $body = @{
    "sheetId" = $sheetIdToAdd
    } | ConvertTo-Json

    Invoke-WebRequest -Uri "https://api.smartsheet.com/2.0/reports/$reportId/sheets" -Method Post -Headers $headers -Body $body

    Gets me this:

    Invoke-WebRequest : { "errorCode" : 1006, "message" : "Not Found", "refId" : "vkcumt" }
    At line:1 char:1

    • Invoke-WebRequest -Uri "https://api.smartsheet.com/2.0/reports/$repor ...
    • + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
      + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

  • Hi @Michael.Limanni

    The Smartsheet API does not currently have a Report method that adds sheets to a Report - you can see a list of the actions you can take in the documentation, here: https://smartsheet.redoc.ly/tag/reports

    Please add your vote to this Product Idea to let the Product team know this is an important functionality for you: Update Reports using the API

    Cheers,
    Genevieve

    Need more help? 👀 | Help and Learning Center

    こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions