A Java wrapper library for the RESTful NetBase Insight API
The library is quite simple and easy to use. You can use HTTP Basic authentication or OAuth 2.0 authentication.
See the API Documentation at https://api.netbase.com/ for more information.
NetBasenb = NetBaseFactory.getInstance("account", "pwd", true);
//NetBase nb_oauth = NetBaseFactory.getInstance("access_token", true);Requestreq = newRequest();
req.addQueryParam("scope", "USER");
try {
Responseres = nb.topics(req);
}
catch (ParamErrorExceptione) {
return;
}
catch (ApiErrorExceptione) {
return;
}Once you have registered your client application, this library help you get/refresh tokens in few steps.
NetbaseOAuthoauth = NetBaseFactory.getOAuthInstance("redirectUri", "clientId", "clientSecret", true);
StringrefreshToken = null;
StringaccessToken = null;
try {
TokenResponsetokenResponse = oauth.getAccessTokenByAuthCode("authorization code");
refreshToken = tokenResponse.getRefreshToken();
accessToken = tokenResponse.getAccessToken();
}
catch (ApiErrorExceptione) {
return;
}
catch (ParamErrorExceptione) {
return;
}You can find more demos under the package com.netbase.insightapi.v2.samples.
This project is licensed under the Apache 2.0 license.