Sure. As others have pointed out, the main URL is a pretty good starting point.
While other code examples work, actual access to JSON content can be single-line. Using the Jackson JSON library, you can do:
Response resp = new ObjectMapper().readValue(new URL("http://dot.com/api/?customerId=1234").openStream(),Response.class);
if you want to link the JSON data in the โAnswerโ that you defined: to get the map, you must:
Map<String,Object> map = new ObjectMapper().readValue(new URL("http://dot.com/api/?customerId=1234").openStream(), Map.class);
regarding adding user information; they are usually transmitted using Basic Auth , in which you pass the base64 encoded user information as the "Authorization" header. To do this, you need to open the HttpURLConnection from the URL and add a header; The JSON access part remains the same.
source share