Skip to content

Commit c131247

Browse files
committed
added header instructions in readme
1 parent 86c5d99 commit c131247

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,39 @@ You can get the latest SDK packages through NuGet. Installation instructions can
3737

3838
Or manually [here][latest_release].
3939

40+
## Custom Request Headers
41+
You can send custom request headers by adding them to the `customData` object.
42+
```cs
43+
void Example()
44+
{
45+
AssistantService assistant = new AssistantService("<username>", "<password>", "<version-date>");
46+
47+
// Create customData object
48+
Dictionary<string, object> customData = new Dictionary<string, object>();
49+
// Create a dictionary of custom headers
50+
Dictionary<string, string> customHeaders = new Dictionary<string, string>();
51+
// Add to the header dictionary
52+
customHeaders.Add("X-Watson-Metadata", "customer_id=some-assistant-customer-id");
53+
// Add the header dictionary to the custom data object
54+
customData.Add(Constants.String.CUSTOM_REQUEST_HEADERS, customHeaders);
55+
56+
var results = assistant.Message("<workspace-id>", "<message-request>", customData: customData);
57+
}
58+
```
59+
60+
## Response Headers
61+
You can get the response headers and the raw json response in the result object.
62+
```cs
63+
void Example()
64+
{
65+
AssistantService assistant = new AssistantService("<username>", "<password>", "<version-date>");
66+
var results = assistant.Message("<workspace-id>", "<message-request>");
67+
68+
var responseHeaders = results.ResponseHeaders; // The response headers
69+
var responseJson = results.ResponseJson; // The raw response json
70+
}
71+
```
72+
4073
## Documentation
4174
Click [here][dotnet-standard-sdk-documentation] for documentation by release and branch.
4275

0 commit comments

Comments
 (0)