Skip to content

Latest commit

History

17 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

netbase-java

A Java wrapper library for the RESTful NetBase Insight API

Using

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.

License

This project is licensed under the Apache 2.0 license.

About

A Java wrapper library for the RESTful NetBase Insight API

Resources

Stars

4 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages