# Integrating Dynatrace with Jenkins for Deployment Events (API v2 Compatibility)

**URL:** <https://community.dynatrace.com/t/integrating-dynatrace-with-jenkins-for-deployment-events-api-v2-compatibility/45937>\
**Category:** Dynatrace API\
**Tags:** jenkins, events, dynatrace-api\
**Created:** [June 5, 2024, 7:21pm UTC](https://community.dynatrace.com/t/integrating-dynatrace-with-jenkins-for-deployment-events-api-v2-compatibility/45937 "2024-06-05T19:21:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pmarchena](https://avatars.discourse-cdn.com/v4/letter/p/e9a140/32.png) [@pmarchena](https://community.dynatrace.com/u/pmarchena)\
**Post date:** [June 5, 2024, 7:21pm UTC](https://community.dynatrace.com/t/integrating-dynatrace-with-jenkins-for-deployment-events-api-v2-compatibility/45937/1 "2024-06-05T19:21:05Z")

</div>

Hi everyone,

I’m working on integrating Dynatrace with Jenkins to send deployment events. I’ve found two resources:

- Official documentation mentioning a plugin: [Docs link](https://docs.dynatrace.com/docs/shortlink/api-deployment-jenkins)
- Blog post referencing a library: [Blog link](https://www.dynatrace.com/news/blog/simplify-and-standardize-dynatrace-integration-to-jenkins-software-delivery-pipelines-with-shared-libraries/)

Both resources use the Events API v1 (POST) with JSON format.

My question: can I use either the plugin or library approach with the updated Events API v2 format?

Any insights on this or recommendations for v2 integration would be greatly appreciated!

---

<div class="post-metadata">

**Author:** ![AntonPineiro](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antonpineiro/32/49_2.png) [@AntonPineiro](https://community.dynatrace.com/u/AntonPineiro)\
**Post date:** [June 6, 2024, 6:53am UTC](https://community.dynatrace.com/t/integrating-dynatrace-with-jenkins-for-deployment-events-api-v2-compatibility/45937/2 "2024-06-06T06:53:35Z")

</div>

Hi,

You can use [Events API v2 - POST an event](https://docs.dynatrace.com/docs/shortlink/api-events-v2-post-event).

Best regards

---

<div class="post-metadata">

**Author:** ![mark\_bley](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/mark_bley/32/20954_2.png) [@mark\_bley](https://community.dynatrace.com/u/mark_bley)\
**Post date:** [June 6, 2024, 10:43am UTC](https://community.dynatrace.com/t/integrating-dynatrace-with-jenkins-for-deployment-events-api-v2-compatibility/45937/3 "2024-06-06T10:43:56Z")

</div>

You could just send the events through curl

```markup
stage('Send Event') {
            steps {
                script {
                    def response = sh(
                        script: """
                            curl -X POST \
                            -H "Content-Type: application/json" \
                            -H "Authorization: Api-Token ${AUTH_TOKEN}" \
                            -d '${PAYLOAD}' \
                            ${DT_URL}
                        """,
                        returnStdout: true
                    ).trim()
                    echo "Response: ${response}"
                }
            }
        }

```

I wrote a PR for the Jenkins integration requesting the update to events v2, maybe you can reuse parts of it.

> <https://github.com/dynatrace-ace/dynatrace-jenkins-library/pull/15>
>
> Use new Events API v2 to send Jenkins events

---

<div class="post-metadata">

**Author:** ![pmarchena](https://avatars.discourse-cdn.com/v4/letter/p/e9a140/32.png) [@pmarchena](https://community.dynatrace.com/u/pmarchena)\
**Post date:** [June 6, 2024, 2:06pm UTC](https://community.dynatrace.com/t/integrating-dynatrace-with-jenkins-for-deployment-events-api-v2-compatibility/45937/4 "2024-06-06T14:06:19Z")

</div>

Hello, thanks for sharing the documentation.

I’m looking for some specific guide.

Greetings

---

<div class="post-metadata">

**Author:** ![pmarchena](https://avatars.discourse-cdn.com/v4/letter/p/e9a140/32.png) [@pmarchena](https://community.dynatrace.com/u/pmarchena)\
**Post date:** [June 6, 2024, 2:10pm UTC](https://community.dynatrace.com/t/integrating-dynatrace-with-jenkins-for-deployment-events-api-v2-compatibility/45937/5 "2024-06-06T14:10:14Z")

</div>

Hello thank you very much.

Thats what Im looking for.  
I’ll try to reuse your code and come back to tell you how it turned out.

Greetings
