# API to fetch the details of HTTP 5XX count

**URL:** <https://community.dynatrace.com/t/api-to-fetch-the-details-of-http-5xx-count/42678>\
**Category:** Dynatrace API\
**Tags:** dynatrace-managed, services-classic, documentation, dynatrace-api\
**Created:** [November 17, 2023, 10:12am UTC](https://community.dynatrace.com/t/api-to-fetch-the-details-of-http-5xx-count/42678 "2023-11-17T10:12:51Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shruts](https://avatars.discourse-cdn.com/v4/letter/s/839c29/32.png) [@Shruts](https://community.dynatrace.com/u/Shruts)\
**Post date:** [November 17, 2023, 10:12am UTC](https://community.dynatrace.com/t/api-to-fetch-the-details-of-http-5xx-count/42678/1 "2023-11-17T10:12:51Z")

</div>

Hi,

I want to fetch the details and count of HTTP 5XX error count through the API. Please help me which specific API can give me the details?

My use cases are:  
I’m trying to integrate API with Jenkins deployment pipeline. If the 5xx error counts are more than previous build error count then new build deployment should not happen.

Kindly provide the specific API who can give me the 5xx error count details.

---

<div class="post-metadata">

**Author:** ![RazTN7](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/raztn7/32/10208_2.png) [@RazTN7](https://community.dynatrace.com/u/RazTN7)\
**Post date:** [November 17, 2023, 10:25am UTC](https://community.dynatrace.com/t/api-to-fetch-the-details-of-http-5xx-count/42678/2 "2023-11-17T10:25:00Z")

</div>

Hello&nbsp;[@Shruts](https://community.dynatrace.com/user/68893)

builtin service.errors.fivexx.count metric is available. Use the V2 API below to fetch the data.

 ![RazTN7X_2-1700216596367.png](https://global.discourse-cdn.com/dynatrace/original/3X/e/4/e4f7817b458781d9e57fd2d978b6fe68989e8da2.png)

 ![RazTN7X_4-1700216645438.png](https://global.discourse-cdn.com/dynatrace/original/3X/e/c/ec536aad1d29f61262e05c072631b46e9f4fce22.png)

Cheers!

RN

---

<div class="post-metadata">

**Author:** ![Shruts](https://avatars.discourse-cdn.com/v4/letter/s/839c29/32.png) [@Shruts](https://community.dynatrace.com/u/Shruts)\
**Post date:** [November 17, 2023, 10:46am UTC](https://community.dynatrace.com/t/api-to-fetch-the-details-of-http-5xx-count/42678/3 "2023-11-17T10:46:08Z")

</div>

Hi,

I’m using the same API for the details but I need to get the understanding of response JSON. Can you please send the documentation for API response JSON? Provided swagger documentation is not sufficient to get the understanding.  
So below is my request and response, Can you help me to get the Error count using that response. What all fields I need to use to fetch 5xx error count.  
**Request** :

https://{environmentid}.live.dynatrace.com/api/v2/metrics/query?metricSelector=builtin%3Aservice.keyRequest.errors.fivexx.count&mzSelector=mzName%28%22Autofix-Openreach\_APP11319%22%29

**Response** :  
{ “totalCount”: 5, “nextPageKey”: null, “resolution”: “1m”, “result”: [{ “metricId”: “builtin:service.keyRequest.errors.fivexx.count”, “dataPointCountRatio”: 0.00003, “dimensionCountRatio”: 0.00005, “data”: [ { “dimensions”: [ “SERVICE\_METHOD-A479BD7918CBADBA”], “dimensionMap”: { “dt.entity.service\_method”: “SERVICE\_METHOD-A479BD7918CBADBA” }, “timestamps”: [1700207520000, 1700207580000, 1700207640000, 1700207700000, 1700207760000, 1700207820000, 1700207880000, 1700207940000, 1700208000000, 1700208060000, 1700208120000, 1700208180000, 1700208240000, 1700208300000, 1700208360000, 1700208420000, 1700208480000, 1700208540000, 1700208600000, 1700208660000, 1700208720000, 1700208780000, 1700208840000, 1700208900000, 1700208960000, 1700209020000, 1700209080000, 1700209140000, 1700209200000, 1700209260000, 1700209320000, 1700209380000, 1700209440000, 1700209500000, 1700209560000, 1700209620000, 1700209680000, 1700209740000, 1700209800000, 1700209860000, 1700209920000, 1700209980000, 1700210040000, 1700210100000, 1700210160000, 1700210220000, 1700210280000, 1700210340000, 1700210400000, 1700210460000, 1700210520000, 1700210580000, 1700210640000, 1700210700000, 1700210760000, 1700210820000, 1700210880000, 1700210940000, 1700211000000, 1700211060000, 1700211120000, 1700211180000, 1700211240000, 1700211300000, 1700211360000, 1700211420000, 1700211480000, 1700211540000, 1700211600000, 1700211660000, 1700211720000, 1700211780000, 1700211840000, 1700211900000, 1700211960000, 1700212020000, 1700212080000, 1700212140000, 1700212200000, 1700212260000, 1700212320000, 1700212380000, 1700212440000, 1700212500000, 1700212560000, 1700212620000, 1700212680000, 1700212740000, 1700212800000, 1700212860000, 1700212920000, 1700212980000, 1700213040000, 1700213100000, 1700213160000, 1700213220000, 1700213280000, 1700213340000, 1700213400000, 1700213460000, 1700213520000, 1700213580000, 1700213640000, 1700213700000, 1700213760000, 1700213820000, 1700213880000, 1700213940000, 1700214000000, 1700214060000, 1700214120000, 1700214180000, 1700214240000, 1700214300000, 1700214360000, 1700214420000, 1700214480000, 1700214540000, 1700214600000, 1700214660000], “values”: [null, 0, 0, 0, null, null, 0, 0, 0, null, null, 0, null, null, null, null, 0, 0, 0, null, null, null, null, 0, null, 0, null, 0, 0, 0, 0, null, null, 0, 0, null, 0, 0, null, null, 0, null, null, null, 0, 0, null, 0, null, 0, 0, null, 0, 0, null, null, null, null, null, null, null, 0, null, null, null, 0, 0, null, 0, null, null, 0, 0, null, 0, 0, 0, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, 0, null, null, 0, 0, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, 0, 0, null, null, null] }, { “dimensions”: [“SERVICE\_METHOD-B99B8DF74BCC6240”], “dimensionMap”: { “dt.entity.service\_method”: “SERVICE\_METHOD-B99B8DF74BCC6240” }, “timestamps”: [1700207520000, 1700207580000, 1700207640000, 1700207700000, 1700207760000, 1700207820000, 1700207880000, 1700207940000, 1700208000000, 1700208060000, 1700208120000, 1700208180000, 1700208240000, 1700208300000, 1700208360000, 1700208420000, 1700208480000, 1700208540000, 1700208600000, 1700208660000, 1700208720000, 1700208780000, 1700208840000, 1700208900000, 1700208960000, 1700209020000, 1700209080000, 1700209140000, 1700209200000, 1700209260000, 1700209320000, 1700209380000, 1700209440000, 1700209500000, 1700209560000, 1700209620000, 1700209680000, 1700209740000, 1700209800000, 1700209860000, 1700209920000, 1700209980000, 1700210040000, 1700210100000, 1700210160000, 1700210220000, 1700210280000, 1700210340000, 1700210400000, 1700210460000, 1700210520000, 1700210580000, 1700210640000, 1700210700000, 1700210760000, 1700210820000, 1700210880000, 1700210940000, 1700211000000, 1700211060000, 1700211120000, 1700211180000, 1700211240000, 1700211300000, 1700211360000, 1700211420000, 1700211480000, 1700211540000, 1700211600000, 1700211660000, 1700211720000, 1700211780000, 1700211840000, 1700211900000, 1700211960000, 1700212020000, 1700212080000, 1700212140000, 1700212200000, 1700212260000, 1700212320000, 1700212380000, 1700212440000, 1700212500000, 1700212560000, 1700212620000, 1700212680000, 1700212740000, 1700212800000, 1700212860000, 1700212920000, 1700212980000, 1700213040000, 1700213100000, 1700213160000, 1700213220000, 1700213280000, 1700213340000, 1700213400000, 1700213460000, 1700213520000, 1700213580000, 1700213640000, 1700213700000, 1700213760000, 1700213820000, 1700213880000, 1700213940000, 1700214000000, 1700214060000, 1700214120000, 1700214180000, 1700214240000, 1700214300000, 1700214360000, 1700214420000, 1700214480000, 1700214540000, 1700214600000, 1700214660000], “values”: [null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, 0, null, null, null, null, null, null, null, null, null, null, null, 0, null, 0, 0, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, 0, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null] }, { “dimensions”: [“SERVICE\_METHOD-3BAA7DD64CC702B6”], “dimensionMap”: { “dt.entity.service\_method”: “SERVICE\_METHOD-3BAA7DD64CC702B6” }, “timestamps”: [1700207520000, 1700207580000, 1700207640000, 1700207700000, 1700207760000, 1700207820000, 1700207880000, 1700207940000, 1700208000000, 1700208060000, 1700208120000, 1700208180000, 1700208240000, 1700208300000, 1700208360000, 1700208420000, 1700208480000, 1700208540000, 1700208600000, 1700208660000, 1700208720000, 1700208780000, 1700208840000, 1700208900000, 1700208960000, 1700209020000, 1700209080000, 1700209140000, 1700209200000, 1700209260000, 1700209320000, 1700209380000, 1700209440000, 1700209500000, 1700209560000, 1700209620000, 1700209680000, 1700209740000, 1700209800000, 1700209860000, 1700209920000, 1700209980000, 1700210040000, 1700210100000, 1700210160000, 1700210220000, 1700210280000, 1700210340000, 1700210400000, 1700210460000, 1700210520000, 1700210580000, 1700210640000, 1700210700000, 1700210760000, 1700210820000, 1700210880000, 1700210940000, 1700211000000, 1700211060000, 1700211120000, 1700211180000, 1700211240000, 1700211300000, 1700211360000, 1700211420000, 1700211480000, 1700211540000, 1700211600000, 1700211660000, 1700211720000, 1700211780000, 1700211840000, 1700211900000, 1700211960000, 1700212020000, 1700212080000, 1700212140000, 1700212200000, 1700212260000, 1700212320000, 1700212380000, 1700212440000, 1700212500000, 1700212560000, 1700212620000, 1700212680000, 1700212740000, 1700212800000, 1700212860000, 1700212920000, 1700212980000, 1700213040000, 1700213100000, 1700213160000, 1700213220000, 1700213280000, 1700213340000, 1700213400000, 1700213460000, 1700213520000, 1700213580000, 1700213640000, 1700213700000, 1700213760000, 1700213820000, 1700213880000, 1700213940000, 1700214000000, 1700214060000, 1700214120000, 1700214180000, 1700214240000, 1700214300000, 1700214360000, 1700214420000, 1700214480000, 1700214540000, 1700214600000, 1700214660000], “values”: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, null, 0, 0, 0, 0, null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] }, { “dimensions”: [“SERVICE\_METHOD-0015D9BE1CFB8193”], “dimensionMap”: { “dt.entity.service\_method”: “SERVICE\_METHOD-0015D9BE1CFB8193” }, “timestamps”: [1700207520000, 1700207580000, 1700207640000, 1700207700000, 1700207760000, 1700207820000, 1700207880000, 1700207940000, 1700208000000, 1700208060000, 1700208120000, 1700208180000, 1700208240000, 1700208300000, 1700208360000, 1700208420000, 1700208480000, 1700208540000, 1700208600000, 1700208660000, 1700208720000, 1700208780000, 1700208840000, 1700208900000, 1700208960000, 1700209020000, 1700209080000, 1700209140000, 1700209200000, 1700209260000, 1700209320000, 1700209380000, 1700209440000, 1700209500000, 1700209560000, 1700209620000, 1700209680000, 1700209740000, 1700209800000, 1700209860000, 1700209920000, 1700209980000, 1700210040000, 1700210100000, 1700210160000, 1700210220000, 1700210280000, 1700210340000, 1700210400000, 1700210460000, 1700210520000, 1700210580000, 1700210640000, 1700210700000, 1700210760000, 1700210820000, 1700210880000, 1700210940000, 1700211000000, 1700211060000, 1700211120000, 1700211180000, 1700211240000, 1700211300000, 1700211360000, 1700211420000, 1700211480000, 1700211540000, 1700211600000, 1700211660000, 1700211720000, 1700211780000, 1700211840000, 1700211900000, 1700211960000, 1700212020000, 1700212080000, 1700212140000, 1700212200000, 1700212260000, 1700212320000, 1700212380000, 1700212440000, 1700212500000, 1700212560000, 1700212620000, 1700212680000, 1700212740000, 1700212800000, 1700212860000, 1700212920000, 1700212980000, 1700213040000, 1700213100000, 1700213160000, 1700213220000, 1700213280000, 1700213340000, 1700213400000, 1700213460000, 1700213520000, 1700213580000, 1700213640000, 1700213700000, 1700213760000, 1700213820000, 1700213880000, 1700213940000, 1700214000000, 1700214060000, 1700214120000, 1700214180000, 1700214240000, 1700214300000, 1700214360000, 1700214420000, 1700214480000, 1700214540000, 1700214600000, 1700214660000], “values”: [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, 0, null, null, null, null, 0, null, null, null, null, null, 0, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, 0, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, 0, null, null, null, null, null, null, null, null, 0, null, null, 0, null, null] }, { “dimensions”: [“SERVICE\_METHOD-5FD35804FF33CAC0”], “dimensionMap”: { “dt.entity.service\_method”: “SERVICE\_METHOD-5FD35804FF33CAC0” }, “timestamps”: [1700207520000, 1700207580000, 1700207640000, 1700207700000, 1700207760000, 1700207820000, 1700207880000, 1700207940000, 1700208000000, 1700208060000, 1700208120000, 1700208180000, 1700208240000, 1700208300000, 1700208360000, 1700208420000, 1700208480000, 1700208540000, 1700208600000, 1700208660000, 1700208720000, 1700208780000, 1700208840000, 1700208900000, 1700208960000, 1700209020000, 1700209080000, 1700209140000, 1700209200000, 1700209260000, 1700209320000, 1700209380000, 1700209440000, 1700209500000, 1700209560000, 1700209620000, 1700209680000, 1700209740000, 1700209800000, 1700209860000, 1700209920000, 1700209980000, 1700210040000, 1700210100000, 1700210160000, 1700210220000, 1700210280000, 1700210340000, 1700210400000, 1700210460000, 1700210520000, 1700210580000, 1700210640000, 1700210700000, 1700210760000, 1700210820000, 1700210880000, 1700210940000, 1700211000000, 1700211060000, 1700211120000, 1700211180000, 1700211240000, 1700211300000, 1700211360000, 1700211420000, 1700211480000, 1700211540000, 1700211600000, 1700211660000, 1700211720000, 1700211780000, 1700211840000, 1700211900000, 1700211960000, 1700212020000, 1700212080000, 1700212140000, 1700212200000, 1700212260000, 1700212320000, 1700212380000, 1700212440000, 1700212500000, 1700212560000, 1700212620000, 1700212680000, 1700212740000, 1700212800000, 1700212860000, 1700212920000, 1700212980000, 1700213040000, 1700213100000, 1700213160000, 1700213220000, 1700213280000, 1700213340000, 1700213400000, 1700213460000, 1700213520000, 1700213580000, 1700213640000, 1700213700000, 1700213760000, 1700213820000, 1700213880000, 1700213940000, 1700214000000, 1700214060000, 1700214120000, 1700214180000, 1700214240000, 1700214300000, 1700214360000, 1700214420000, 1700214480000, 1700214540000, 1700214600000, 1700214660000], “values”: [0, 0, 0, 0, 0, null, 0, 0, 0, 0, 0, 0, 0, 0, null, 0, null, 0, null, 0, null, 0, 0, null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, null, 0, 0, 0, 0, 0, 0, null, 0, 0, 0, null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, null, null, 0, 0, 0, 0, 0, 0, null, 0, 0, null, 0, null, 0, 0, 0, 0, 0, 0, 0, null, 0, 0, 0, 0, 0, null, 0, null, 0, null, 0, 0, 0, 0, 0, null, 0, 0, 0, 0, 0, null, 0, 0, 0, 0, 0, 0, null, 0, 0, 0, 0] } ] } ] }

---

<div class="post-metadata">

**Author:** ![RazTN7](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/raztn7/32/10208_2.png) [@RazTN7](https://community.dynatrace.com/u/RazTN7)\
**Post date:** [November 17, 2023, 1:04pm UTC](https://community.dynatrace.com/t/api-to-fetch-the-details-of-http-5xx-count/42678/4 "2023-11-17T13:04:55Z")

</div>

I see you are using&nbsp;keyRequest.errors.fivexx.count metric. From the response body I could see the count as 0 or null.

Can you try&nbsp;builtin:service.errors.fivexx.count

or

Create a calculate metric for your specific request with 5xx logic in it. And use the calc metric in API v2 Metric

Ref -&nbsp;[Metrics API - GET metric data points — Dynatrace Docs](https://docs.dynatrace.com/docs/dynatrace-api/environment-api/metric-v2/get-data-points)

---

<div class="post-metadata">

**Author:** ![Shruts](https://avatars.discourse-cdn.com/v4/letter/s/839c29/32.png) [@Shruts](https://community.dynatrace.com/u/Shruts)\
**Post date:** [November 23, 2023, 11:19am UTC](https://community.dynatrace.com/t/api-to-fetch-the-details-of-http-5xx-count/42678/5 "2023-11-23T11:19:59Z")

</div>

Hi,  
I’m getting the response against&nbsp;dt.entity.servicefor example&nbsp;&nbsp;“dt.entity.service”: “SERVICE-D08B16288DB7A0C4”

How can I get the service name against each of the service Id ?

---

<div class="post-metadata">

**Author:** ![RazTN7](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/raztn7/32/10208_2.png) [@RazTN7](https://community.dynatrace.com/u/RazTN7)\
**Post date:** [November 24, 2023, 4:46am UTC](https://community.dynatrace.com/t/api-to-fetch-the-details-of-http-5xx-count/42678/6 "2023-11-24T04:46:41Z")

</div>

Hey

You can get service ID by clicking on any service then check the url.

![RazTN7X_0-1700800041974.png](https://global.discourse-cdn.com/dynatrace/original/3X/6/4/645384d0f0e1e579246b7b2f3a5003b724b94cf2.png)

Next question could be “is there any way to get it through API?”

Yes. Its vice versa. If you know service name you could get ID. If you know ID you could get service name.

_api/v2/entities --\>&nbsp;entitySelector_

_To get ID_

type(SERVICE),entityName.equals(_\<SERVICE\_NAME\>_)&nbsp; &nbsp; OR&nbsp; type(SERVICE),entityName.contains(_\<SERVICE\_NAME\>_)

To get service name

type(SERVICE),entityId.equals(\<SERVICE\_ENTITY\_ID\>)

Cheers!

RN

---

<div class="post-metadata">

**Author:** ![jdport](https://avatars.discourse-cdn.com/v4/letter/j/ce73a5/32.png) [@jdport](https://community.dynatrace.com/u/jdport)\
**Post date:** [June 19, 2024, 7:08pm UTC](https://community.dynatrace.com/t/api-to-fetch-the-details-of-http-5xx-count/42678/7 "2024-06-19T19:08:19Z")

</div>

Is there a way to filter this by a specific request or requests?&nbsp; &nbsp; Other than creating a custom metric?
