Added partition key header for get document example.

This commit is contained in:
Daniel Edwards 2018-05-10 22:50:59 -07:00
Родитель 1e245c3d10
Коммит 5fe9de7ad9
1 изменённых файлов: 7 добавлений и 0 удалений

Просмотреть файл

@ -52,6 +52,11 @@ namespace REST_from.NET
static readonly string databaseId = "sandpit";
static readonly string collectionId = "data";
static readonly string documentId = "test";
// The partition key is required when getting a document. The value of this is expected
// to be a JSON serilized array of strings.
static readonly string partitionKey = JsonConvert.SerializeObject(new []{"abc123"});
static bool idBased = true;
static readonly string utc_date = DateTime.UtcNow.ToString("r");
@ -127,6 +132,8 @@ namespace REST_from.NET
authHeader = GenerateMasterKeyAuthorizationSignature(verb, resourceId, resourceType, masterKey, "master", "1.0");
client.DefaultRequestHeaders.Add("x-ms-documentdb-partitionkey", partitionKey);
client.DefaultRequestHeaders.Remove("authorization");
client.DefaultRequestHeaders.Add("authorization", authHeader);