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

Code Generation from Settings schema



I am curious if anyone has had luck generating code (specifically Java) from the schemas provided by the Settings API. I realize the openapi definition of the Dynatrace API is available at .../rest-api-docs/v2/spec3.json, but this does not contain details of all the Settings schemas one can retrieve.

For example, I'm attempting to do some work with Maintenance Windows. Using the Settings API to retrieve the schema for Maintenance Windows, I get the attached file. This file is not in a schemas format I'm familiar with, like openapi or json-schema. Doing a straight POJO conversion doesn't seem to help much or be appropriate, as then properties are not defined properly as fields.

Has anyone been able to generate useful code based on these schemas? Thanks for any insight.


DynaMight Legend
DynaMight Legend

That is the typical Jason output format for Dynatrace. So I recommend making a generic maintenance window that would fit your use case. For example if you want your CICD Pipeline to set a MW in the deployment process, then I highly recommend making a MW in the Dynatrace UI targeting a sample scope. So lets say my Easytravel app will have a deployment, I would make a MW in the UI that looks at a common tag or even a hostgroup in which those entities are included in. or list each host one by one even tho that's not very scalable.  Set it the way it should be via the Dynatrace UI, then export the Json of it via the Dynatrace API. then you can take that payload and blank out the segments you want users to configure such as the time frame, and the entities via the defined tag or host group etc... 

We did this in our CICD pipeline and now each time a deployment goes through its lifecycle a MW is automatically posted via the API. 


Thank you for the response. Yes, the plan will be to create a MW as part of our CICD pipeline. I was hoping that code generation from the schema returned by the API or an SDK would be available. As you say, a generic maintenance window class tailored to our use case won't be too bad to generate, though. Thanks.

Featured Posts