cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to update/create a Dashboard using document service of Dynatrace?

heramb_sawant
Organizer

Hi Team,
I am creating a workflow in the new Dynatrace; this workflow has a DQL query as 1st task, and then in 2nd task(js code)  I want to add this DQL result to the dashboard. Here I want to update the dashboard by DQL results.

How to do that? Somebody, please provide some examples.

I read somewhere using document service, we can create a notebook, similarly, I want to create a dashboard using js code.

Regards,
Heramb


Regards,
Heramb Sawant

5 REPLIES 5

Fin_Ubels
Dynatrace Champion
Dynatrace Champion

Hey Heramb,

You can use the new platform API for this. To get there you would go to https://Your.Tenant.Address.com/platform/swagger-ui/index.html?urls.primaryName=Document%20Service#/. Currently this is documented in our developer docs here https://developer.dynatrace.com/platform-services/#swagger-ui

Then from there you could follow the following steps to see how the document creation and editing process works as well as the format for requests:

  1. GET /documents to find the ID of an example dashboard or notebook you want to use as a template.
  2. GET /documents/{id}/content to get the layout that you would need to mimic.
  3. POST /documents to then post an example document.

Once you have a template setup you would then in your script just do POST /documents to create a new document with your desired DQL OR do PUT /documents/{id}/content to update an already existing document with your DQL query.

Hope this helps!

Hey thanks Fin for your help. This will definitely help to move forward.

Regards,
Heramb

Hey ,
I m trying to update my own dashboard( having id f3592b6d-XXXXXXXX411ae35) using  "updateDocumentContent" method but getting below exception 

Uncaught (in promise) 409: Share of type 'environment' with access 'read' already exists for document 'f3592b6d-XXXXXXXX411ae35'. errorRef: 282afd6c-2125-435b-8af5-f92fd10d670a

What needs to be changed?? and What should be the value of optimisticLockingVersion???

Regards,
Heramb

Hey ,
Somebody please help me on this.

Regards,
Heramb

Hey Heramb,

Hopefully you've already come across the solution. I was unable to find anything regarding that exact error or reproduce it but as for the optimisticLockingVersion field, if you first GET the document you'll get a version returned. This is NOT the version in the document JSON but in it's metadata. The optimisticLockingVersion field needs to be this latest version. Every time a document is updated, this version will update and to update it through the API you'll need this latest version every time.

 

Fin_Ubels_1-1695261037334.png

 

Featured Posts