Book Image

DynamoDB Cookbook

By : Tanmay Deshpande
Book Image

DynamoDB Cookbook

By: Tanmay Deshpande

Overview of this book

Table of Contents (18 chapters)
DynamoDB Cookbook
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Developing services for the Address Book application


Now that we are done with the sign-up and sign-in activities for our address book application, it's time to get star ted with developing address-related services. In this recipe, we will develop two APIs, one to add a new contact and another one to view all the contacts.

Getting ready

To get started with this recipe, you should have performed the earlier recipe.

How to do it…

For this recipe, we will also use the same project setup that we had earlier:

  1. To get started, we need to first create a model class for a contact record in the contact table. Here, we create the table with the hash key as ID (auto-generated) and the range key as the parent ID (e-mail ID of the user who added this contact):

    @DynamoDBTable(tableName = "contact")
    public class Contact {
      private String id;
      private String parentId;
      private String fname;
      private String lname;
      private String phone;
      private String email;
      @DynamoDBHashKey
      @DynamoDBAutoGeneratedKey...