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

Is it possible to manage segments using API?

panumjp
Participant

Or using terraform or monaco?

 

 

8 REPLIES 8

zaid-bashir
Advisor

Hi @panumjp 
To Manage Segments there is no API Support, you can create/manage segments via UI only using Segments App.

Julius_Loman
DynaMight Legend
DynaMight Legend

@panumjp Sure there is API!

Have a look at the platform APIs:

https://[env].apps.dynatrace.com/platform/swagger-ui/index.html?urls.primaryName=Grail+-+Filter+Segm...

Additionally, there is incoming Segment support in Monaco, currently under a feature flag (Monaco 2.20)

Certified Dynatrace Master | Alanata a.s., Slovakia, Dynatrace Master Partner

Thanks @Julius_Loman for the input.
I checked the above URL and it redirected me to App Engine App Functions API which will execute the Backend Of The Custum App.

zaidbashir_0-1740653310888.png

I want to know how it will help us for in managing segments. Thanks 

@zaid-bashir just chose the segments API in the combo box at the top of the swagger UI

Certified Dynatrace Master | Alanata a.s., Slovakia, Dynatrace Master Partner

thanks! I was able to find the API!

Useful API call indeed to list the segments, I include it here to help others, my question I want to include this on a dashboard via DQL? otherwise can an API call be included in a tile on my dashboard?

 

curl -X "GET" ^  "https://<YOUR_TENNANT>/platform/storage/filter-segments/v1/filter-segments" ^  -H "accept: application/json" ^  -H "Authorization: Bearer <YOUR_PLATFORM_BEARER_TOKEN>"

 

Thanks Julius, I am able to extract the definition of the object of the segment created in the UI, but how one can create and delete this object using the above API?, e.g. here is a segment I created manually and extracted from the GUI I need to use this as a template to create number of segments. can you help in pointing out the exact API that I should use: I list here the JSON: {
"name": "app.environment_ops.machinetype_ops:component",
"isPublic": true,
"includes": [
{
"filter": "{\"type\":\"Group\",\"range\":{\"from\":0,\"to\":84},\"logicalOperator\":\"AND\",\"explicit\":false,\"explicitLogicalOperator\":true,\"children\":[{\"type\":\"Statement\",\"range\":{\"from\":0,\"to\":21},\"key\":{\"type\":\"Key\",\"range\":{\"from\":0,\"to\":15},\"textValue\":\"app.environment\",\"value\":\"app.environment\"},\"operator\":{\"type\":\"ComparisonOperator\",\"textValue\":\"=\",\"value\":\"=\",\"range\":{\"from\":16,\"to\":17}},\"value\":{\"type\":\"String\",\"range\":{\"from\":18,\"to\":21},\"textValue\":\"dev\",\"value\":\"dev\"}},{\"type\":\"Statement\",\"range\":{\"from\":26,\"to\":52},\"key\":{\"type\":\"Key\",\"range\":{\"from\":26,\"to\":41},\"textValue\":\"ops.machinetype\",\"value\":\"ops.machinetype\"},\"operator\":{\"type\":\"ComparisonOperator\",\"textValue\":\"=\",\"value\":\"=\",\"range\":{\"from\":42,\"to\":43}},\"value\":{\"type\":\"String\",\"range\":{\"from\":44,\"to\":52},\"textValue\":\"weblogic\",\"value\":\"weblogic\"}},{\"type\":\"Statement\",\"range\":{\"from\":57,\"to\":83},\"key\":{\"type\":\"Key\",\"range\":{\"from\":57,\"to\":70},\"textValue\":\"ops.component\",\"value\":\"ops.component\"},\"operator\":{\"type\":\"ComparisonOperator\",\"textValue\":\"=\",\"value\":\"=\",\"range\":{\"from\":71,\"to\":72}},\"value\":{\"type\":\"String\",\"range\":{\"from\":73,\"to\":83},\"textValue\":\"ao_payment\",\"value\":\"ao_payment\"}}]}",
"dataObject": "_all_data_object",
"applyTo": []
},
{
"filter": "{\"type\":\"Group\",\"range\":{\"from\":0,\"to\":72},\"logicalOperator\":\"OR\",\"explicit\":false,\"explicitLogicalOperator\":true,\"children\":[{\"type\":\"Statement\",\"range\":{\"from\":0,\"to\":34},\"key\":{\"type\":\"Key\",\"range\":{\"from\":0,\"to\":11},\"textValue\":\"entity.name\",\"value\":\"entity.name\"},\"operator\":{\"type\":\"ComparisonOperator\",\"textValue\":\"=\",\"value\":\"=\",\"range\":{\"from\":12,\"to\":13}},\"value\":{\"type\":\"String\",\"range\":{\"from\":14,\"to\":34},\"textValue\":\"\\\"[BUSINESS_APP] E Smoketest\\\"\",\"value\":\"[BUSINESS_APP] E Smoketest\"}},{\"type\":\"Statement\",\"range\":{\"from\":38,\"to\":72},\"key\":{\"type\":\"Key\",\"range\":{\"from\":38,\"to\":49},\"textValue\":\"entity.name\",\"value\":\"entity.name\"},\"operator\":{\"type\":\"ComparisonOperator\",\"textValue\":\"=\",\"value\":\"=\",\"range\":{\"from\":50,\"to\":51}},\"value\":{\"type\":\"String\",\"range\":{\"from\":52,\"to\":72},\"textValue\":\"\\\"[PACA] E Smoketest\\\"\",\"value\":\"[PACA] E Smoketest\"}}]}",
"dataObject": "dt.entity.synthetic_test",
"applyTo": []
},
{
"filter": "{\"type\":\"Group\",\"range\":{\"from\":0,\"to\":19},\"logicalOperator\":\"AND\",\"explicit\":false,\"explicitLogicalOperator\":false,\"children\":[{\"type\":\"Statement\",\"range\":{\"from\":0,\"to\":18},\"key\":{\"type\":\"Key\",\"range\":{\"from\":0,\"to\":11},\"textValue\":\"entity.name\",\"value\":\"entity.name\"},\"operator\":{\"type\":\"ComparisonOperator\",\"textValue\":\"=\",\"value\":\"=\",\"range\":{\"from\":12,\"to\":13}},\"value\":{\"type\":\"String\",\"range\":{\"from\":14,\"to\":18},\"textValue\":\"BUSINESS_APP\",\"value\":\"BUSINESS_APP\"}}]}",
"dataObject": "dt.entity.cloud_application_namespace",
"applyTo": []
}
]
}

 

Featured Posts