This is a wrapper around the Zoom API that allows us to call it using native Java code.
-
Native Java calls instead of using HTTP
ZoomUser user = api.getUser("me");
-
Transparently use either JWT or OAuth authentication - the calls automatically use whichever is configured correctly
-
Automatically refreshes OAuth tokens correctly when needed
-
Wraps both
page_number
andnext_page_token
in a proper Java Iterator so paging records is transparently managed in the background (WIP: Not Implemented Yet)
The main class that wraps all API calls is ZoomAPI
. Initialize this class and you’re ready to go making all Zoom calls.
ZoomAPI za = new ZoomAPI(authenticator);
za.createMeeting(user, meetingrequest);
Depending on the type of App we are using (see the Zoom Getting Started Guide), we need to initialize the ZoomAPI
with the appropriate Authenticator.
In order to use a JWT App, first create your app on the Zoom marketplace and get it’s JWT token.
Initialize your ZoomAPI
with a ZoomAuthenticatorJWT
and you’re ready to go.
ZoomAuthorizerJWT authorizer = new ZoomAuthorizerJWT(JWTToken);
ZoomAPI za = new ZoomAPI(authorizer);
// Get User
ZoomUser user = za.getUser("me");
System.out.println(user);
// Create a new meeting
ZoomMeetingRequest mreq = ZoomMeetingRequest.requestDefaults("Test Meeting", "Let's talk about the weather");
ZoomMeeting meeting = za.createMeeting("me", mreq);
System.out.println(meeting);
Create an OAuth application in the marketplace and set it’s callback to your application webhook. This allows users to click a link like this:
https://zoom.us/oauth/authorize?response_type=code&client_id=7lstjK9NTyett_oeXtFiEQ&redirect_uri=https://yourapp.com
and give your app permissions to make calls on their after reviewing what permissions you need:
When you get this request, use the ZoomAPI::requestAccessToken
call to get a ZoomAccessToken
that can be used for making calls on behalf of the user.
// Use your app's secrets to convert the user
// 'code' into an access token you can use to
// make calls on their behalf
ZoomAuthorizerGetOAuthToken authorizer = new ZoomAuthorizerGetOAuthToken(clientID, clientSecret);
ZoomAPI za = new ZoomAPI(authorizer);
String code = req.params.get("code"); // get 'code' query parameter from callback
ZoomAccessToken oauthToken = za.requestAccessToken(code, redirectURL);
db.save(oauthToken); // save the token for use
Once you have a user token you can use it to make calls on the user’s behalf.
ZoomAuthorizerOAuth authorizer = new ZoomAuthorizerOAuth(oauthToken);
ZoomAPI za = new ZoomAPI(clientID, clientSecret, authorizer);
// Get User
ZoomUser user = za.getUser("me");
System.out.println(user);
// Create a new meeting
ZoomMeetingRequest mreq = ZoomMeetingRequest.requestDefaults("Test Meeting", "Let's talk about the weather");
ZoomMeeting meeting = za.createMeeting("me", mreq);
System.out.println(meeting);
For more clarity, an example this flow is in OAuthTest.java
.
- Pagination
- Other API calls
Contributions & Feedback welcome