Get data from remote Orthanc server

Hello,

I have question for you.

I prepared app on Java Spring which works with local orthanc server.
Now I have to get data using Orthanc Rest API from remote server which IP I have.
This server have username and password and I dont know what I have to add to my code to it works correctly.

Everything work correctly with my localhost orthanc server probably because I can run in without username and password.
On remote server I have to have password. So what I have to add?

My example code which get instances ids:

private static final String ORTHANC = "http://myIP:8042/";
public List<String> getInstancesId() {
    RestTemplate restTemplate = new RestTemplate();
    String url = ORTHANC + "instances/";

    ResponseEntity<Collection> serverResponse = restTemplate.getForEntity(url, Collection.class);
    return (List<String>) serverResponse.getBody();
}

Hi,

This is a question regarding using Java HttpClient with http authentication. You’re best to try Google/Search/StackOverflow for help. Try https://duckduckgo.com/?q=java+http+request+username+password

There may be others more familiar with Java Http requests than me.

James

Binary Logo

James Manners • Director
Suite 3, Level 2, 10 Queens Road, Melbourne, Victoria 3004, Australia

T: 03 9017 5230 M: 0422 973 235 E: james@binary.com.au W: binary.com.au

Hi,
thanks for response.

If someone need help with that in the future I found solution there: https://stackoverflow.com/questions/21920268/basic-authentication-for-rest-api-using-spring-resttemplate

W dniu czwartek, 2 lipca 2020 09:23:36 UTC+2 użytkownik James Manners napisał: