Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Azure DocumentDB

You're reading from   Learning Azure DocumentDB Create outstanding enterprise solutions around DocumentDB using the latest technologies and programming tools with Azure

Arrow left icon
Product type Paperback
Published in Nov 2015
Publisher
ISBN-13 9781783552467
Length 152 pages
Edition 1st Edition
Concepts
Arrow right icon
Author (1):
Arrow left icon
Riccardo Becker Riccardo Becker
Author Profile Icon Riccardo Becker
Riccardo Becker
Arrow right icon
View More author details
Toc

Getting all databases

In order to get a list of all the databases inside a collection, we use the following C# snippet:

  client.DefaultRequestHeaders.Add("x-ms-date", DateTime.UtcNow.ToString("r"));
  client.DefaultRequestHeaders.Add("x-ms-version", "2015-08-06");
  //get signature based on masterkey and the resourcetype dbs (no resourceId involved yet).
  signature = GetSignature(masterKey, "", "dbs", "GET");
  client.DefaultRequestHeaders.Add("authorization", signature);
  string getResponse = client.GetStringAsync(new Uri(baseUri, "dbs")).Result;

Using Fiddler to enter the raw REST input, we get the following result:

Getting all databases

The output of this REST call is shown in the following screenshot:

Getting all databases
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image