From 13855dd8a3e9979f8d2ffd095c09995200333e4c Mon Sep 17 00:00:00 2001 From: Pierre-Yves FARE Date: Fri, 12 Nov 2021 10:08:03 +0000 Subject: [PATCH] Mention usage of http request headers in readme. fix #332 --- readme.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/readme.md b/readme.md index 3cfae7e0..998efd7a 100644 --- a/readme.md +++ b/readme.md @@ -189,6 +189,27 @@ var serializer = new JsonNetApiClientSerialization(); serializer.DefaultOptions.IgnoreNullValues = false; ``` +### HTTP Request Headers + +APIs that support specifying HTTP request headers have an optional method argument to pass in header values. + +For example, to specify a stream transaction ID when creating a document: + + +```csharp +await adb.Document.PostDocumentAsync( + "MyCollection", + new MyClass + { + ItemNumber = 123456, + Description = "Some item" + }, + new DocumentHeaderProperties() + { + TransactionId = "0123456789" + }); +``` + ### API Errors Any time an endpoint responds with an HTTP status code which is not a "success" code, an `ApiErrorException` will be thrown. You may wish to wrap your API calls in a try/catch block, and catch `ApiErrorException` in certain circumstances.