I'm using the Stackoverflow JSON API to retrieve questions marked with a given tag.
I have this small program in Java which retrieves questions marked with the "Java" tag.
public static void main(String[] args) throws Exception
{
String urlString = "https://api.stackexchange.com/2.1/questions?order=desc&sort=votes&tagged=java&site=stackoverflow";
URL url = new URL( urlString );
BufferedReader reader = null;
StringBuffer buffer = new StringBuffer();
try
{
URLConnection connection = url.openConnection();
InputStream isConn = connection.getInputStream();
reader = new BufferedReader( new InputStreamReader( new GZIPInputStream( isConn ) ) );
String inputLine;
while (( inputLine = reader.readLine() ) != null)
{
buffer.append( inputLine );
}
}
finally
{
if (reader != null)
{
reader.close();
}
}
JSONObject jsonObject = new JSONObject( buffer.toString() );
JSONArray jsonArray = jsonObject.getJSONArray( "items" );
System.out.println( buffer );
System.out.println( jsonArray.length() );
}
My problem is that it returns only 30 questions. Since my goal is to build a dataset for further textual analysis, I need to access way more than just 30 questions.
Is there a way to adjust the size of the returned list?
If not, how can I workaround this situation?