0

Now I am forming the URL in the browser, and execute it via REST api like

localhost:9043/api/json?apiKey=699cccc3dcfb348fd369e083bcd7f2a4&Severity=all

and will get some JSON Object output.

Instead of working on browser, I need to give the URL in the java code itself and to get the json object output also in java code itself. I have searched but not found yet. Need some experts answer for my question.

Rahul
  • 44,383
  • 11
  • 84
  • 103
Noor
  • 1

1 Answers1

0

it's just an HTTP call like any other, so you call it like any other HTTP call from a Java application, and get the results from that call like that as well.
So look up HttpURLConnection and go from there.

jwenting
  • 5,505
  • 2
  • 25
  • 30
  • This is half an answer. The OP will still need to take the JSON and turn it into something they can work with, though. – Ian McLaird Feb 06 '14 at 14:33
  • @IanMcLaird of course, but that's out of scope of his question on how to call a servlet from Java code. For that he'd need to call a JSON parser and work with the result of that, another thing he can find with a quick Google call. – jwenting Feb 06 '14 at 14:39