Lesson 1. Your First App

Google tutorial for Java developers

Let's create your first app using Spotware's Open API. It will be a console application in Java. So:

  1. Set up JDK and Maven

  2. Create a new java project with maven:

mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
  1. Import the project as a maven project in your favourite IDE. Images below are made from Intellij IDEA but you can use Eclipse, NetBeans or something else.

    Import the project

    Open the project

  2. Create a method for requesting schema description. This method makes a http request and returns document as string.

    Getting the schema

  3. Other requests required of OAuth authentication. Next lesson will describe how to get your OAuth token and use it for requests.

    In this lesson we will prepare infrastructure objects. Let's create java classes according to got schema from the previous step. For serialization/deserialization JSON object will be used Jackson processor.

    Creating model classes

  4. These classes were taken from Open API server side. They use Apache Common Lang library and Jackson JSON processor. These dependencies were added to maven pom.xml file.

    Adding dependencies

Sources of this lesson can be found at GitHub