Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.evernote:evernote-sdk-java:1.25.1'
}
dependencies {
implementation("com.github.evernote:evernote-sdk-java:1.25.1")
}
<dependency>
<groupId>com.github.evernote</groupId>
<artifactId>evernote-sdk-java</artifactId>
<version>1.25.1</version>
</dependency>
libraryDependencies += "com.github.evernote" % "evernote-sdk-java" % "1.25.1"
:dependencies [[com.github.evernote/evernote-sdk-java "1.25.1"]]
Evernote API version 1.25
This SDK contains wrapper code used to call the Evernote Cloud API from Java applications.
For Android-specific code and samples, see the Evernote SDK for Android.
The SDK also contains two samples. The code in sample/oauth
demonstrates the basic use of the SDK. The code in sample/client
also demonstrates the basic use of API, but uses developer tokens instead of OAuth for authentication.
JavaDocs for the SDK are available at http://dev.evernote.com/documentation/reference/javadoc/.
In order to use the Cloud API, you need to obtain an API key from http://dev.evernote.com/documentation/cloud. You'll also find full API documentation on that page.
In order to run the sample code, you need a user account on the sandbox service where you will do your development. Sign up for an account at https://sandbox.evernote.com/Registration.action
In order to run the client client sample code, you need a developer token. Developer tokens make it easy to learn your way around the API without needing to worry about OAuth. Get one at https://sandbox.evernote.com/api/DeveloperToken.action
The easiest way to incorporate the SDK into your Java project is to use Maven. If you're using Maven already, simply add a new dependency to your pom.xml
:
<dependency>
<groupId>com.evernote</groupId>
<artifactId>evernote-api</artifactId>
<version>1.25.1</version>
</dependency>
If you'd prefer to build the SDK yourself, it's as simple as running
$ mvn package
You'll find evernote-sdk-1.25.1.jar
in the target directory after the build completes. This single JAR contains everything needed to use the API.
The code in sample/client/EDAMDemo.java
demonstrates the basics of using the Evernote API, using developer tokens instead of OAuth to simplify the authentication process while you're learning. Real applications that support multiple users need to use OAuth.
Build the SDK library
$ mvn package
sample/client/EDAMDemo.java
EDAMDemo
class and fill in your Evernote developer token.On the command line, run the following command to compile the class:
$ javac -classpath ../../target/evernote-api-1.25.1.jar EDAMDemo.java
On the command line, run the following command to execute the sample app:
$ java -classpath .:../../target/evernote-api-1.25.1.jar EDAMDemo
Real applications use OAuth to authenticate to the Evernote service. At the end of the OAuth flow you'll have an authentication token that you can use to access the Cloud API in the same way that the developer token is used in the client sample code. The code in sample/oauth
demonstrate the OAuth authentication process.
sample/oauth/src/main/webapp/index.jsp
Build the sample project:
$ cd sample/oauth
$ mvn package
Deploy sample/oauth/target/EDAMWebTest.war
to your servlet container (e.g. Tomcat)
http://localhost:8080/EDAMWebTest
)Real applications use OAuth to authenticate to the Evernote service with Scala / Play framework. You need to install Scala and Play first.
app/controllers/Evernote.scala
play run
http://localhost:9000
)A user-community Clojure wrapper to the Evernote Java SDK is available at https://github.com/mikebroberts/clojurenote . The library provides OAuth authentication, read/write capabilities (using an OAuth access token, or developer token) and ENML to HTML translation. A sample compojure / ring app is also provided to show how OAuth workflow can be implemented.