-
Notifications
You must be signed in to change notification settings - Fork 2
Getting Started
dec4234 edited this page Sep 5, 2020
·
6 revisions
Here you can learn what is required for starting work with the API. The core class is called DestinyAPI, this is where you set your api key, and optionally: the client id, secret, and oauth code.
DestinyAPI api = new DestinyAPI().setApiKey("YOUR_API_KEY_HERE").setClientID("CLIENT_ID").setClientSecret("CLIENT_SECRET").setOauthCode("OAUTH_CODE");
DestinyAPI has to be initialized prior to any of the features inside the API that make requests to Bungie.net. The Client id, client secret and oauth code only need to be used whenever oauth is in play, so to start you don't need to bother with them.
Let's say we wanted to get all users with the name dec4234
for(BungieUser bu : api.getUsersWithName("dec4234")) {
if(bu.isValidUser()) {
System.out.println(bu.getDisplayName());
}
}
It is good practice to check if the user is valid prior to getting information about them, as users can have an account on bungie.net without actually having any destiny profile information to get.