Book Image

Learning Azure DocumentDB

By : Riccardo Becker
Book Image

Learning Azure DocumentDB

By: Riccardo Becker

Overview of this book

Learning DocumentDB adopts a practical, step-by-step approach to help you learn the basics of DocumentDB and use your new-found abilities in real-life scenarios and enterprise solutions. We start with the absolute basics, such as setting up a DocumentDB environment, and guide you through managing your databases, and executing simple and complex queries. Next, we explain how to work with DocumentDB using the open REST protocol, and demonstrate how JavaScript works with DocumentDB. We’ll also show you how to authenticate and execute queries. Moving on, you’ll find out how to use DocumentDB from within Node.js to kick-start your Node.js projects. Next, you’ll discover how to increase the performance of your DocumentDB database and fine-tune it. Finally, you’ll get to grips with using DocumentDB in conjunction with other services offered from the Microsoft Azure platform.
Table of Contents (15 chapters)
Learning Azure DocumentDB
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Understanding the basics of REST


Representational State Transfer (REST) is a software architecture for building web services. REST communicates over HTTP using the HTTP verbs GET, POST, PUT, and DELETE. REST operations involve resources and the HTTP verbs indicate what actions to perform. The following sections describe the HTTP verbs in combination with REST and demonstrate some typical operations. The four above-mentioned verbs are sufficient to perform all the CRUD operations we need in modern systems.

Check out the following table to see the differences between the verbs and some examples:

Verb

Operation

Happy flow

Unhappy flow

POST

Creates a resource

POST/devices

201 created

404 not found or 409 conflict when item already exists

GET

Gets a resource

GET/devices

Returns a list of all devices

GET/devices/{id}

Returns a specific device or 404 not found if the device does not exist

PUT

Updates a resource

PUT/devices

Potentially updates the complete collections of...