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

When calling the log search API, encountered error: 'OAuth token is missing'

Ning
Newcomer

I want to use the Dynatrace API to query logs. Following the documentation requirements, I created an Access Token and granted it the 'logs.read' scope.

However, when calling the API, the following error occurred:

 

{
    "error": {
        "code": 401,
        "message": "OAuth token is missing"
    }
}

 


The way I called it:

 

Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.get("https://{environmentid}.live.dynatrace.com/api/v2/logs/search")
   .header("Authorization", "Api-Token dt0c01.xxxxx.xxxxx")
   .header("Content-Type", "application/json")
   .body("")
   .asString();

 

 

1 REPLY 1

Featured Posts