Build something great. Vimeo's API supports flexible, high-quality video integration with your custom apps.
Supported Java version is 8+.
The generated code uses a few Maven dependencies e.g., Jackson, OkHttp, and Apache HttpClient. The reference to these dependencies is already added in the pom.xml file will be installed automatically. Therefore, you will need internet access for a successful build.
- In order to open the client library in Eclipse click on
File -> Import.
- In the import dialog, select
Existing Java Projectand clickNext.
- Browse to locate the folder containing the source code. Select the detected location of the project and click
Finish.
- Upon successful import, the project will be automatically built by Eclipse after automatically resolving the dependencies.
- After successfully building the project, the client library needs to be installed as a Maven package in your local cache. Right-click on the project, select
Show in Local Terminal -> Terminalor useCtrl + Alt + Tto open Terminal.
- In the terminal dialog, run the following command to install client library.
mvn install -Dmaven.test.skip=true -Dmaven.javadoc.skip=true
The following section explains how to use the VimeoApiLib library in a new project.
For starting a new project, click the menu command File > New > Project.
Next, choose Maven > Maven Project and click Next.
Here, make sure to use the current workspace by choosing Use default Workspace location, as shown in the picture below and click Next.
Following this, select the quick start project type to create a simple project with an existing class and a main method. To do this, choose maven-archetype-quickstart item from the list and click Next.
In the last step, provide a Group Id and Artifact Id as shown in the picture below and click Finish.
The created Maven project manages its dependencies using its pom.xml file. In order to add a dependency on the VimeoApiLib client library, double click on the pom.xml file in the Package Explorer. Opening the pom.xml file will render a graphical view on the canvas. Here, switch to the Dependencies tab and click the Add button as shown in the picture below.
Clicking the Add button will open a dialog where you need to specify VimeoApiLib in Group Id, vimeo-api-lib in Artifact Id and 3.4.9 in the Version fields. Once added click OK. Save the pom.xml file.
Once the SimpleConsoleApp is created, a file named App.java will be visible in the Package Explorer with a main method. This is the entry point for the execution of the created project.
Here, you can add code to initialize the client library and instantiate a Controller class. Sample code to initialize the client library and using controller methods is given in the subsequent sections.
Note: Documentation for the client can be found here.
The following parameters are configurable for the API Client:
| Parameter | Type | Description |
|---|---|---|
| httpClientConfig | Consumer<HttpClientConfiguration.Builder> |
Set up Http Client Configuration instance. |
| loggingConfig | Consumer<ApiLoggingConfiguration.Builder> |
Set up Logging Configuration instance. |
| bearerCredentials | BearerCredentials |
The Credentials Setter for OAuth 2 Bearer token |
| oauth2AuthorizationCodeCredentials | Oauth2AuthorizationCodeCredentials |
The Credentials Setter for OAuth 2 Authorization Code Grant |
| oauth2ClientCredentialsCredentials | Oauth2ClientCredentialsCredentials |
The Credentials Setter for OAuth 2 Client Credentials Grant |
The API client can be initialized as follows:
import com.vimeo.api.VimeoApiClient;
import com.vimeo.api.authentication.BearerModel;
import com.vimeo.api.authentication.Oauth2AuthorizationCodeModel;
import com.vimeo.api.authentication.Oauth2ClientCredentialsModel;
import com.vimeo.api.exceptions.ApiException;
import com.vimeo.api.http.response.ApiResponse;
import com.vimeo.api.models.OauthScopeOauth2AuthorizationCode;
import com.vimeo.api.models.OauthScopeOauth2ClientCredentials;
import com.vimeo.api.models.OauthToken;
import java.io.IOException;
import java.util.Arrays;
import org.slf4j.event.Level;
public class Program {
public static void main(String[] args) {
VimeoApiClient client = new VimeoApiClient.Builder()
.loggingConfig(builder -> builder
.level(Level.DEBUG)
.requestConfig(logConfigBuilder -> logConfigBuilder.body(true))
.responseConfig(logConfigBuilder -> logConfigBuilder.headers(true)))
.httpClientConfig(configBuilder -> configBuilder
.timeout(0))
.bearerCredentials(new BearerModel.Builder(
"AccessToken"
)
.build())
.oauth2AuthorizationCodeCredentials(new Oauth2AuthorizationCodeModel.Builder(
"OAuthClientId",
"OAuthClientSecret",
"OAuthRedirectUri"
)
.oauthScopes(Arrays.asList(
OauthScopeOauth2AuthorizationCode.AI,
OauthScopeOauth2AuthorizationCode.CREATE
))
.build())
.oauth2ClientCredentialsCredentials(new Oauth2ClientCredentialsModel.Builder(
"OAuthClientId",
"OAuthClientSecret"
)
.oauthScopes(Arrays.asList(
OauthScopeOauth2ClientCredentials.AI,
OauthScopeOauth2ClientCredentials.CREATE
))
.build())
.build();
}
}This API uses the following authentication schemes.
bearer (OAuth 2 Bearer token)oauth2_authorization_code (OAuth 2 Authorization Code Grant)oauth2_client_credentials (OAuth 2 Client Credentials Grant)
- API Apps Webhooks
- API Information Essentials
- Authentication Extras Authenticate
- Authentication Extras Convert
- Authentication Extras Essentials
- Authentication Extras Exchange
- Channels Privatechannelmembers
- Channels Subscriptionsandsubscribers
- Embed Presets Customlogos
- Embed Presets Essentials
- Embed Presets Folders
- Embed Presets Timelineevents
- Embed Presets Videos
- Live Audiotracks
- Live Embedprivacy
- Live Event M3 U8 Playback
- Live Eventactivation
- Live Eventautomatedclosedcaptions
- Live Eventdestinations
- Live Eventend
- Live Eventlowlatency
- Live Eventsessions
- Live Eventthumbnails
- Live Eventvideos
- On Demand Backgrounds
- On Demand Essentials
- On Demand Genres
- On Demand Posters
- On Demand Promotions
- On Demand Purchasesandrentals
- On Demand Regions
- On Demand Seasons
- On Demand Videos
- Showcases Customshowcaselogos
- Showcases Customshowcasethumbnails
- Showcases Showcasevideos
- Subscription Plans Essentials
- Users Watchhistory
- Videos Animatedthumbnails
- Videos Contentratings
- Videos Creative Commons
- Videos Embedprivacy
- Videos Live M3 U8 Playback
- Videos Nondestructivetrimming
- Videos Texttracks
- Videos Unlistedvideos
- Videos Videocomments
- Watch Later Queue Essentials
- Categories Channels
- Categories Essentials
- Categories Groups
- Categories Users
- Categories Videos
- Channels Categories
- Channels Essentials
- Channels Moderators
- Channels Tags
- Channels Videos
- Folders Essentials
- Folders Items
- Folders Videos
- Groups Essentials
- Groups Subscriptions
- Groups Users
- Groups Videos
- Likes Essentials
- Live Analytics
- Live Essentials
- Live Graphics
- Live Scenes
- Payments Essentials
- Portfolios Essentials
- Portfolios Videos
- Search Federated
- Showcases Essentials
- Tags Essentials
- Teams Essentials
- Teams Members
- Tutorial Essentials
- Users Analytics
- Users Essentials
- Users Feeds
- Users Followers
- Users LMS
- Users Pictures
- Users Search
- Videos AI
- Videos Chapters
- Videos Credits
- Videos Essentials
- Videos Fragments
- Videos Languages
- Videos Moderation
- Videos Recommendations
- Videos Showcases
- Videos Tags
- Videos Thumbnails
- Videos Transcripts
- Videos Uploads
- Videos Versions
- ApiLoggingConfiguration
- ApiLoggingConfiguration.Builder
- ApiRequestLoggingConfiguration.Builder
- ApiResponseLoggingConfiguration.Builder
- Configuration Interface
- HttpClientConfiguration
- HttpClientConfiguration.Builder
- HttpProxyConfiguration
- HttpProxyConfiguration.Builder