I am hitting API with this code-
 public static int hitUrl(String urlToHit)
    {
       try
        {
            URL url = new URL(urlToHit);
            HttpURLConnection http = (HttpURLConnection)url.openConnection();
            int statusCode = http.getResponseCode();
            return statusCode;
        }
        catch(Exception e)
        {
            e.printStackTrace();
            return 0;
        }
    }
Like this I am getting return value 200. It means I am hitting url successfully. But I have to store output of API. My API returns uniqueId. How can I store the output ?
 
     
     
     
     
    