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();

 

 

2 REPLIES 2

Donald_Foss_SCC
Newcomer

Did you find a solution? I have the exact same issue. I'm using a freshly created token with only log.read access.

On a side note, with your request in the example, you don't need to set the content-type header on a GET request. You're not sending any data for which you need to specify the type of content. However, you do need to specify your query parameters.

I guess there aren't that many of us using this API.

Featured Posts