<?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 Re: Does anyone know why my java code to call the REST API is failing when it works via a browser? in Dynatrace API</title>
    <link>https://community.dynatrace.com/t5/Dynatrace-API/Does-anyone-know-why-my-java-code-to-call-the-REST-API-is/m-p/116749#M801</link>
    <description>&lt;P&gt;Thanks Rodrigo... I ended up switching to use a filter on host groups and that worked perfectly. It would, indeed, look like the issue relates to some of the special characters found in our tag names. &lt;/P&gt;&lt;BR /&gt;</description>
    <pubDate>Fri, 12 Apr 2019 15:44:43 GMT</pubDate>
    <dc:creator>jeff_rowell</dc:creator>
    <dc:date>2019-04-12T15:44:43Z</dc:date>
    <item>
      <title>Does anyone know why my java code to call the REST API is failing when it works via a browser?</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/Does-anyone-know-why-my-java-code-to-call-the-REST-API-is/m-p/116747#M799</link>
      <description>&lt;P&gt;I am trying to use the DT API to programmatically retrieve&lt;BR /&gt;information on monitored hosts. My code is implemented in Java and it works&lt;BR /&gt;correctly until I try to add a parameter to return only hosts that have a&lt;BR /&gt;specific tag. I.e., I make a call referencing a URL like:&lt;/P&gt;&lt;P&gt;&lt;A href="https://dtmanaged-lab/e/%3cour"&gt;https://dtmanaged-lab/e/&amp;lt;our&lt;/A&gt;&lt;BR /&gt;env ID&amp;gt;/api/v1/entity/infrastructure/hosts?Api-Token=&amp;lt;the token&amp;gt;&amp;amp;tag=APP=MyAppTag(ABC)&lt;BR /&gt;– ENV=TEST&lt;/P&gt;&lt;P&gt;This fails when it is called via the java code, but works if I&lt;BR /&gt;copy/paste the URL into a browser. If, however, I remove the tag reference (as&lt;BR /&gt;below) it works when called by my java program.&lt;/P&gt;&lt;P&gt;&lt;A href="https://dtmanaged-lab/e/%3cour"&gt;https://dtmanaged-lab/e/&amp;lt;our&lt;/A&gt;&lt;BR /&gt;env ID&amp;gt;/api/v1/entity/infrastructure/hosts?Api-Token=&amp;lt;the token&amp;gt;&lt;/P&gt;&lt;P&gt;Has anyone encountered this type of problem before? Since the URL&lt;BR /&gt;works in a browser and works if I remove the tag reference I wonder if the&lt;BR /&gt;&amp;amp; character, or perhaps other characters that are in my tag like the ‘(‘ or&lt;BR /&gt;‘)’ character are somehow causing the code to fail. I initially assumed, of course, that there was something wrong with how my code was constructing the URL, but as mentioned above the URL (as shown when I run the program in debug mode) looks correct + works when I copy/paste it into a browser.&lt;/P&gt;&lt;P&gt;My code looks like the&lt;BR /&gt;following, and the failure occurs when creating the input stream reader. &lt;/P&gt;&lt;P&gt;myUrl = &lt;STRONG&gt;new&lt;/STRONG&gt; URL(httpsURL);&lt;/P&gt;&lt;P&gt;conn = (HttpsURLConnection)myUrl.openConnection();&lt;/P&gt;&lt;P&gt;is = conn.getInputStream();&lt;/P&gt;&lt;P&gt;isr = &lt;STRONG&gt;new&lt;/STRONG&gt; InputStreamReader(is);&lt;/P&gt;&lt;P&gt;br = &lt;STRONG&gt;new&lt;/STRONG&gt; BufferedReader(isr);&lt;/P&gt;&lt;P&gt;APICallResults = br.readLine();&lt;/P&gt;&lt;P&gt;The IOException error I receive states “at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown&lt;BR /&gt;Source)”&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 09 Apr 2019 18:53:18 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/Does-anyone-know-why-my-java-code-to-call-the-REST-API-is/m-p/116747#M799</guid>
      <dc:creator>jeff_rowell</dc:creator>
      <dc:date>2019-04-09T18:53:18Z</dc:date>
    </item>
    <item>
      <title>Re: Does anyone know why my java code to call the REST API is failing when it works via a browser?</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/Does-anyone-know-why-my-java-code-to-call-the-REST-API-is/m-p/116748#M800</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I think your code is having issues while parsing the URL, try to do the same query but instead of using an complex tag like "tag=APP=MyAppTag(ABC) – ENV=TEST" create a manual one "test" and try with "tag=test". &lt;BR /&gt;This should work and then move forward with the rest of special characters you are using on your tags&lt;BR /&gt;&lt;BR /&gt;Regards&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 10 Apr 2019 19:41:20 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/Does-anyone-know-why-my-java-code-to-call-the-REST-API-is/m-p/116748#M800</guid>
      <dc:creator>rodrigo_alvare1</dc:creator>
      <dc:date>2019-04-10T19:41:20Z</dc:date>
    </item>
    <item>
      <title>Re: Does anyone know why my java code to call the REST API is failing when it works via a browser?</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/Does-anyone-know-why-my-java-code-to-call-the-REST-API-is/m-p/116749#M801</link>
      <description>&lt;P&gt;Thanks Rodrigo... I ended up switching to use a filter on host groups and that worked perfectly. It would, indeed, look like the issue relates to some of the special characters found in our tag names. &lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 12 Apr 2019 15:44:43 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/Does-anyone-know-why-my-java-code-to-call-the-REST-API-is/m-p/116749#M801</guid>
      <dc:creator>jeff_rowell</dc:creator>
      <dc:date>2019-04-12T15:44:43Z</dc:date>
    </item>
  </channel>
</rss>

