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

Can't call API by dynatrace but succeed with postman

Quirina
Guide

Hi Team, We're planning to use dynatrace to do the API monitoring. I'm facing one issue - I'm able to call one API successfully with postman but failed with Dynatrace. Request url and http hearder and requestbody are all same.  But I got error all the time from dynatrace. I checked the error as below:

Quirina_0-1697594958349.png

The script setting as below:

Quirina_1-1697595071988.png

Could anyone help to check why it often fail, please?

4 REPLIES 4

AntonPineiro
DynaMight Guru
DynaMight Guru

Hi,

You can see an entry about Troubleshooting HTTP Monitor Error/ Health Status Codes.

Are you sure header and payload in body are correct?

Best regards

❤️ Emacs ❤️ Vim ❤️ Bash ❤️ Perl

I checked the headers and found the root cause is due to lack of one header. Thank you so much for the reminder!!

Perfect and welcome! 😎

❤️ Emacs ❤️ Vim ❤️ Bash ❤️ Perl

radek_jasinski
DynaMight Guru
DynaMight Guru

Hi,

You are given the wrong Service name.

In the first step, use the API (GET entities list) to retrieve the list of services. Then use the name (entityId) of the service you want to use using the name that was returned after the API (it differs slightly from what you see in the GUI)

Example:

curl -L -X GET 'https://mySampleEnv.live.dynatrace.com/api/v2/entities?entitySelector=type(%22SERVICE%22),mzId(%2291...' \
-H 'Authorization: Api-Token xxx'

{ "totalCount": 52, "pageSize": 50, "nextPageKey": "AQArdHlwZSgiU0VSVklDRSIpL", "entities": [ { "entityId": "SERVICE-1125C375A187D27A","displayName": "dotNetBackend_easyTravel_x64", "lastSeenTms": 1590609632865, "properties": { "serviceTechnologyTypes": [ "IIS app pool", "ASP.NET", "DotNet" ] } },

 

Radek

Have a nice day!

Featured Posts