In this post we are going to learn how to create a application starting from the in and deployement to , to building the application. 9Gag RESTful API Go AWS Elastic Beanstalk Android All the code used on this demo is available on my Github: RESTful API Android Application 1 — RESTful API To build this application we need a to crawl through website. Hopefully I have already written a that do the hardest task for us. So the only thing we need to do is setup an which expose a single endpoint to fetch memes by their tag. REST API 9Gag 9Gag client HTTP server in Go So make sure to grap the packages: go get github.com/mlabouardy/9gaggo get github.com/gorilla/mux : 9Gag web crawler 9gag : Request router and dispatcher for matching incoming requests to their respective handler mux Once the dependencies are installed, create an “ ” file, with the following content: app.go Let’s test it out, by typing the following command: go run app.go If you point your favorite web browser (not you IE) to , you should see: http://localhost:3000/memes/geek Let’s try again with a different tag: The application will consumes the . Therefore the must be accessible by the Internet. Android API JSON response API 2 — Deployement on AWS Elastic Beanstalk Note: I already did a on how to use EB, so make sure to read it for more details. tutorial We will deploy the API inside a container. In order to dockerize the service, we need two files : Docker : To create a that contains your source bundle: Dockerfile Docker image : To deploy the app on , it tells EB which port it needs to expose. Dockerrun.aws.json AWS EB Now we have all files required for deployment. We will use the , so start by typing “ ” as below: EB CLI eb init Then, type “ “: eb create Once deployed, go to : Elastic Beanstalk Dashboard If you point your browser to the app url shown above: 3 — Android Application If you already created your , just go ahead and start from the next section. Otherwise, create a new project in your favorite . I prefer with as the build system, but you can surely use your IDE of choice or as well. Android project IDE Android Studio Gradle Maven So open , under the “ ” menu, select “ “: Android studio Quick Start Start a new Android Studio project At first, add the libraries for the project in your file: build.gradle We will performs againt the we deployed earlier. Executing those requests from an application requires the to open network sockets. So make sure to require in your file: HTTP requests API Android Internet permission Internet permission AndroidManifest.xml <uses-permission android:name=”android.permission.INTERNET”/> Add the below , , resources to respective files under directory: string dimen color res Before we start writing the code, I always start with planning the layout: As you can notice above the will contains the , & . And each row of the will have a , , and a as wrapper to create the effect. main_activity.xml ListView Toolbar SearchBar ListView TextView NetworkImageView LinearLayout Card Let’s create an xml layout that presents each indiviual meme item row in a customised way: Now under the package, create a class named that populates the model into the adapter MemesAdapter Meme ListView: Create a class named under package and add the following code. This class takes care of caching network images on disk for better performances: BitmapLruCache utils We need to define the . The following code defines the and a method to request list of memes for a given tag. The annotation declares that this request uses the method. The code snippet also illustrates the usage of ‘s path parameter replacement functionality. In the defined method the path will be replaced with the given variable values when calling the method. API Endpoint MemeService findByTag @GET HTTP GET Retrofit {tag} findByTag There is a defined class . This class is a simple with _getters_and : Meme POJO setters Note: The annotation is used to map the JSON attribute to the right Entity field. @SerializedName Now we have all the required classes in place. Open the class and add the following code: MainActivity This class creates the , calls the every time a user type a new tag in the and handles the results (It passes the memes list to the which populates the ) Retrofit client MemeService SearchBar MemesAdapter ListView The output of the application in action is shown below: This brings an end to this tutorial. In the upcoming tutorial I will show you how to do with , and with Unit Tests JUnit UI Tests Espresso.