O'Reilly logo

Learning Azure DocumentDB by Riccardo Becker

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required