This project aims to provide a Java wrapper to the Stack Exchange API.
- SDK supports Stack Exchange API V2.2
Getting Started
There are two interfaces to the library.
- Query Interface
- Facade Interface
Feature
Asynchronous API Examples of using the API asynchronously are described in Asynchronous API.
Advanced Usage Advanced usage like changing API providers or paging through the results are described in Advanced Usage.
Spring Configuration If you plan to use the library in conjunction with Spring framework, this brief tutorial will guide you. Spring Configuration
Query API Query API provides a Builder like syntax to the StackOverflow? API.There are similar Query interfaces for Answers, Comments, Timelines, Badges etc.
Switch Site Fetching records from different site are described here.
Advance Search Advance search feature available in SDK.
Code Snippet
StackExchangeApiQueryFactory queryFactory = StackExchangeApiQueryFactory
.newInstance("applicationKey",
StackExchangeSite.STACK_OVERFLOW);
// Get all questions.
String filter = "default";
Paging paging = new Paging(1, 100);
PagedList<Question> questions = queryFactory.newQuestionApiQuery()
.withPaging(paging).withFilter(filter)
.withSort(Question.SortOrder.MOST_HOT)
.withTags(tag).list();
//Get questions by answer ids.
long answerId = 21859130;
PagedList<Question> question3s =
queryFactory.newQuestionApiQuery()
.withPaging(paging).withFilter(filter)
.withSort(Question.SortOrder.MOST_RECENTLY_CREATED)
.withTags(tag).withAnswerIds(answerId).listQuestionsByAnswer();
Code
Source code is available under my sanjivsingh/stackoverflow-java-sdk repository.
Issues
Please feel free to raise bugs/issues at GitHub issues
Or You can contact me here sanjiv.singh