22 Nov 2022
04:12 AM
- last edited on
22 Nov 2022
07:48 AM
by
MaciejNeumann
Hi I want to post deployment events with some information for particular host (i.e. HOST A), could someone explain how to do that via API.
I am using https://www.dynatrace.com/support/help/dynatrace-api/environment-api/events-v2/post-event
It's not mentioned where and how to pass host information.
Solved! Go to Solution.
You filter which entities an event should apply to via the entitySelector field where you enter an entity selector.
You could pass a single entityId or conditions that will match only that host.
There's a sample payload in the "Push deployment events from Jenkins" section of the documentation
https://www.dynatrace.com/support/help/shortlink/api-deployment-jenkins
{
"eventType": "CUSTOM_DEPLOYMENT",
"attachRules": {
"tagRule": {
"meTypes": "PROCESS_GROUP_INSTANCE",
"tags": "Dev"
}
},
"deploymentName": "${JOB_NAME}",
"deploymentVersion": "1.1",
"deploymentProject": "CustomBankingService",
"remediationAction": "http://revertMe",
"ciBackLink": "${BUILD_URL}",
"source": "Jenkins",
"customProperties": {
"Jenkins Build Number": "${BUILD_ID}",
"Git commit": "${GIT_COMMIT}"
}
}
Will we be able to inject the missing master data (machines , services), in case it doesn't exists