# Trouble retrieving notebook results (or even notebook as a whole) via API

**URL:** <https://community.dynatrace.com/t/trouble-retrieving-notebook-results-or-even-notebook-as-a-whole-via-api/55365>\
**Category:** Dynatrace API\
**Tags:** notebooks, dynatrace-api\
**Created:** [March 25, 2026, 4:08pm UTC](https://community.dynatrace.com/t/trouble-retrieving-notebook-results-or-even-notebook-as-a-whole-via-api/55365 "2026-03-25T16:08:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dcbarry](https://avatars.discourse-cdn.com/v4/letter/d/c0e974/32.png) [@dcbarry](https://community.dynatrace.com/u/dcbarry)\
**Post date:** [March 25, 2026, 4:08pm UTC](https://community.dynatrace.com/t/trouble-retrieving-notebook-results-or-even-notebook-as-a-whole-via-api/55365/1 "2026-03-25T16:08:28Z")

</div>

I’m having trouble determining how to retrieve the results of an already defined DQL query in a notebook. I’ve reviewed docs everywhere, but can seem to get it functional.&nbsp; &nbsp;My token has full read rights everywhere, and is the owner of the notebook (my personal api).&nbsp;The UUIDs are triple confirmed as valid. (Short and long form).

I keep getting 404 (not found) error, although the docs imply this is the way.&nbsp; (“api/v1/documents”).

My code looks like this: (Fake tenant IDs)

I am aware I’m supposed to be able to invoke DQL from my API call directly, this is not a desirable solution.&nbsp; &nbsp;Wish to use what is already in the notebook.

$DynaHost = “https://{environmentid}.live.dynatrace.com”

#Note: I’ve tried both the extended and short forms of the ID  
#$NotebookId = “27268a8e-4667-4373-beda-dddb427f0ead#9b9fde91-f574-47bd-b89a-7c4584d1e02d”  
$NotebookId = “27268a8e-4667-4373-beda-dddb427f0ead”

$ApiUrl = “$DynaHost/api/v1/documents/$NotebookId”

try {  
&nbsp; &nbsp; $notebookContent = Invoke-RestMethod -Uri $ApiUrl -Headers $Headers -Method Get  
&nbsp; &nbsp; Write-Host “Content for Notebook $NotebookId”  
&nbsp; &nbsp; $notebookContent | ConvertTo-Json -Depth 99 | Out-File -FilePath “C:\temp\$NotebookId.json”  
} catch {  
&nbsp; &nbsp; Write-Host ‘Error retrieving notebook content: $\_.Exception.Message’  
}

---

<div class="post-metadata">

**Author:** ![MaximilianoML](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/maximilianoml/32/25038_2.png) [@MaximilianoML](https://community.dynatrace.com/u/MaximilianoML)\
**Post date:** [March 25, 2026, 4:55pm UTC](https://community.dynatrace.com/t/trouble-retrieving-notebook-results-or-even-notebook-as-a-whole-via-api/55365/2 "2026-03-25T16:55:43Z")

</div>

Hello&nbsp;[@dcbarry](https://community.dynatrace.com/user/102724)

Let me see if I can help you with this one…

I was checking your code and maybe miss the “platform” in the endpoint.

```javascript
$DynaHost = "https://{environmentid}.live.dynatrace.com"
$NotebookId = "27268a8e-4667-4373-beda-dddb427f0ead"

# Metadata
$MetaUrl = "$DynaHost/platform/document/v1/documents/$NotebookId"

# Content download
$ContentUrl = "$DynaHost/platform/document/v1/documents/$NotebookId/content"

try {
    $notebookMeta = Invoke-RestMethod -Uri $MetaUrl -Headers $Headers -Method Get
    $notebookMeta | ConvertTo-Json -Depth 99 | Out-File "C:\temp\$NotebookId-meta.json"

    Invoke-WebRequest -Uri $ContentUrl -Headers $Headers -Method Get -OutFile "C:\temp\$NotebookId-content.bin"

    Write-Host "Notebook metadata retrieved successfully."
    Write-Host "Notebook content downloaded to C:\temp\$NotebookId-content.bin"
}
catch {
    Write-Host ("Error retrieving notebook: " + $_.Exception.Message)
    if ($_.ErrorDetails.Message) {
        Write-Host $_.ErrorDetails.Message
    }
}

```

And in my POV&nbsp;there is not a supported “give me the already-rendered result set from this notebook section” endpoint, unfortunately. The supported path is to read the notebook content, extract the DQL from the section, and execute that DQL through the Grail Query API.

I hope this helps you&nbsp;:grinning\_face:

---

<div class="post-metadata">

**Author:** ![dcbarry](https://avatars.discourse-cdn.com/v4/letter/d/c0e974/32.png) [@dcbarry](https://community.dynatrace.com/u/dcbarry)\
**Post date:** [March 25, 2026, 5:26pm UTC](https://community.dynatrace.com/t/trouble-retrieving-notebook-results-or-even-notebook-as-a-whole-via-api/55365/3 "2026-03-25T17:26:52Z")

</div>

Thanks for responding!

HHmm.. that gives me a 403 forbidden, error. However, I noted I accidentally deleted the build of headers in my original code.&nbsp; Including:

“Authorization” = “Bearer $Apitoken”&nbsp; &nbsp; “Content-Type” &nbsp;= "application/json"Applying them did not change the response though.&nbsp; I’m wlking though it a bit more closely, I’ll update again, just wanted to give a quick thanks, and note my other error.

---

<div class="post-metadata">

**Author:** ![MaximilianoML](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/maximilianoml/32/25038_2.png) [@MaximilianoML](https://community.dynatrace.com/u/MaximilianoML)\
**Post date:** [March 25, 2026, 5:29pm UTC](https://community.dynatrace.com/t/trouble-retrieving-notebook-results-or-even-notebook-as-a-whole-via-api/55365/4 "2026-03-25T17:29:28Z")

</div>

My pleasure, happy to help. Keep us updated this topic is really interesting, actually

---

<div class="post-metadata">

**Author:** ![dcbarry](https://avatars.discourse-cdn.com/v4/letter/d/c0e974/32.png) [@dcbarry](https://community.dynatrace.com/u/dcbarry)\
**Post date:** [April 8, 2026, 7:55pm UTC](https://community.dynatrace.com/t/trouble-retrieving-notebook-results-or-even-notebook-as-a-whole-via-api/55365/5 "2026-04-08T19:55:31Z")

</div>

hey, just thought you’d like to know, i decided to take the other approach, and directly do a DQL query as suggested.&nbsp; &nbsp; However, now Im having token troubles. LOL.&nbsp; &nbsp; so, i reposted with examples.

---

<div class="post-metadata">

**Author:** ![MaximilianoML](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/maximilianoml/32/25038_2.png) [@MaximilianoML](https://community.dynatrace.com/u/MaximilianoML)\
**Post date:** [April 9, 2026, 7:51am UTC](https://community.dynatrace.com/t/trouble-retrieving-notebook-results-or-even-notebook-as-a-whole-via-api/55365/6 "2026-04-09T07:51:16Z")

</div>

Heyy! Nice to know, could you gently attach the link to this new post, please? If this helped you, and if you think it’s fair, Kudos helps me&nbsp;:grin:
