I use web api, but i has errors with 401 (unauthorzation)

I want to get the result of the sonarqube by using web api ( /api/issues/search )

so i code it by java like that

	private static HttpURLConnection testHttpUrlConnection() throws MalformedURLException, IOException{
		
		URL url = new URL ("http://localhost:9000/api/issues/search");
		
		HttpURLConnection httpConn = (HttpURLConnection)url.openConnection();
		httpConn.setRequestMethod("GET");
		httpConn.setRequestProperty("pageSize", "500");
		httpConn.setRequestProperty("componentKeys", "myprojectname");
		httpConn.setRequestProperty("severities", "BLOCKER");

but, it returns 401 .
because of the authentication.

so i want to know how to set authentication and
how to get authentication information(like token?) for setting it.

if you have some sample please share it.

Hey there.

The SonarQube Web API accepts basic authentication, so you likely want to follow a tutorial like this