<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic When calling the log search API, encountered error: 'OAuth token is missing' in Dynatrace API</title>
    <link>https://community.dynatrace.com/t5/Dynatrace-API/When-calling-the-log-search-API-encountered-error-OAuth-token-is/m-p/240097#M2984</link>
    <description>&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;However, when calling the API, the following error occurred:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
    "error": {
        "code": 401,
        "message": "OAuth token is missing"
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The way I called it:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Unirest.setTimeouts(0, 0);
HttpResponse&amp;lt;String&amp;gt; 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();&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 16 Mar 2024 14:58:11 GMT</pubDate>
    <dc:creator>Ning</dc:creator>
    <dc:date>2024-03-16T14:58:11Z</dc:date>
    <item>
      <title>When calling the log search API, encountered error: 'OAuth token is missing'</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/When-calling-the-log-search-API-encountered-error-OAuth-token-is/m-p/240097#M2984</link>
      <description>&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;However, when calling the API, the following error occurred:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
    "error": {
        "code": 401,
        "message": "OAuth token is missing"
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The way I called it:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Unirest.setTimeouts(0, 0);
HttpResponse&amp;lt;String&amp;gt; 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();&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Mar 2024 14:58:11 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/When-calling-the-log-search-API-encountered-error-OAuth-token-is/m-p/240097#M2984</guid>
      <dc:creator>Ning</dc:creator>
      <dc:date>2024-03-16T14:58:11Z</dc:date>
    </item>
    <item>
      <title>Re: When calling the log search API, encountered error: 'OAuth token is missing'</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/When-calling-the-log-search-API-encountered-error-OAuth-token-is/m-p/240098#M2985</link>
      <description>&lt;P&gt;The document I refer to is : &lt;A href="https://docs.dynatrace.com/docs/dynatrace-api/environment-api/log-monitoring-v2/get-search-logs" target="_blank"&gt;https://docs.dynatrace.com/docs/dynatrace-api/environment-api/log-monitoring-v2/get-search-logs&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Mar 2024 14:58:51 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/When-calling-the-log-search-API-encountered-error-OAuth-token-is/m-p/240098#M2985</guid>
      <dc:creator>Ning</dc:creator>
      <dc:date>2024-03-16T14:58:51Z</dc:date>
    </item>
    <item>
      <title>Re: When calling the log search API, encountered error: 'OAuth token is missing'</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/When-calling-the-log-search-API-encountered-error-OAuth-token-is/m-p/244524#M3091</link>
      <description>&lt;P&gt;Did you find a solution? I have the exact same issue. I'm using a freshly created token with only log.read access.&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;I guess there aren't that many of us using this API.&lt;/P&gt;</description>
      <pubDate>Wed, 01 May 2024 15:37:42 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/When-calling-the-log-search-API-encountered-error-OAuth-token-is/m-p/244524#M3091</guid>
      <dc:creator>Donald_Foss_SCC</dc:creator>
      <dc:date>2024-05-01T15:37:42Z</dc:date>
    </item>
    <item>
      <title>Re: When calling the log search API, encountered error: 'OAuth token is missing'</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/When-calling-the-log-search-API-encountered-error-OAuth-token-is/m-p/251043#M3265</link>
      <description>&lt;P&gt;A bit late to the party, but found that you need to use a token from an OAuth client with the permissions &lt;SPAN&gt;&lt;STRONG&gt;storage:buckets:read&lt;/STRONG&gt; and &lt;STRONG&gt;storage:logs:read&lt;/STRONG&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;You first need to create a client on the UI, then obtain a bearer token with the right scopes and use that to authenticate with the logs API (note you'll need to pass a header &lt;STRONG&gt;Authorization: Bearer &amp;lt;token&amp;gt;&lt;/STRONG&gt; as opposed to the old &lt;STRONG&gt;Authorization: Api-token &amp;lt;token&amp;gt;&lt;/STRONG&gt;).&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.dynatrace.com/docs/shortlink/ba-api-ingest#authentication" target="_self"&gt;This docs page&lt;/A&gt; should help guide you even though it's for biz events/DQL queries. The process is the same, the only thing that changes are the scopes you need.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2024 06:19:52 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/When-calling-the-log-search-API-encountered-error-OAuth-token-is/m-p/251043#M3265</guid>
      <dc:creator>TomásSeroteRoos</dc:creator>
      <dc:date>2024-07-19T06:19:52Z</dc:date>
    </item>
  </channel>
</rss>

