/// <summary> /// Like GET, but only returns the header fields and not the body. You /// can use this call to get the current revision of a document or check if /// the document was deleted. /// HEAD/_api/document/{document-handle} /// </summary> /// <param name="documentId"></param> /// <param name="headers">Object containing a dictionary of Header keys and values</param> /// <exception cref="System.ArgumentException">Document ID is invalid.</exception> /// <remarks> /// 200: is returned if the document was found. /// 304: is returned if the “If-None-Match” header is given and the document has the same version. /// 404: is returned if the document or collection was not found. /// 412: is returned if an “If-Match” header is given and the found document has a different version. The response will also contain the found document’s current revision in the Etag header. /// </remarks> /// <returns></returns> public virtual async Task <HeadDocumentResponse> HeadDocumentAsync( string documentId, HeadDocumentHeader headers = null) { ValidateDocumentId(documentId); string uri = _docApiPath + "/" + documentId; WebHeaderCollection headerCollection; if (headers == null) { headerCollection = new WebHeaderCollection(); } else { headerCollection = headers.ToWebHeaderCollection(); } using (var response = await _client.HeadAsync(uri, headerCollection)) { return(new HeadDocumentResponse { Code = (HttpStatusCode)response.StatusCode, Etag = response.Headers.ETag }); } }