0

I want to get the JSON data from solarwinds orion rest api and have to write those JSON data in excel file.

  • Please share what all things have you tried? – AbhiN Feb 28 '20 at 07:04
  • Hi Abhi, I just tried the some solarwinds orion rest request to get cpu load and memmory load for specific start time and end time trough POSTMAN. https://github.com/solarwinds/OrionSDK/wiki/REST POST "BulkUpdate Request" – Mohammed Razirth Feb 28 '20 at 07:20

1 Answers1

0

I'm assuming you need a java program to send a post request to an API endpoint. ApacheHTTP library to the rescue. You can read more from the documentation here. Even more information in the official apache website

HttpClient httpclient = HttpClients.createDefault();
HttpPost httppost = new HttpPost("http://www.a-domain.com/foo/");

// Request parameters and other properties.
List<NameValuePair> params = new ArrayList<NameValuePair>(2);
params.add(new BasicNameValuePair("param-1", "12345"));
params.add(new BasicNameValuePair("param-2", "Hello!"));
httppost.setEntity(new UrlEncodedFormEntity(params, "UTF-8"));

//Execute and get the response.
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();

if (entity != null) {
    try (InputStream instream = entity.getContent()) {
        // do something useful
    }
}

Taken from this answer