Skip to content

Commit 79f796b

Browse files
authored
Merge pull request #440 from watson-developer-cloud/docs-transaction-id
Add documentation on setting transaction id
2 parents 331ebe5 + d0e0df3 commit 79f796b

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ void Example()
228228
Discovery v2 is only available on Cloud Pak for Data.
229229

230230
## Transaction IDs
231-
Every SDK call returns a response with a transaction ID in the x-global-transaction-id header. This transaction ID is useful for troubleshooting and accessing relevant logs from your service instance.
231+
Every SDK call returns a response with a transaction ID in the `X-Global-Transaction-Id` header. Together the service instance region, this ID helps support teams troubleshoot issues from relevant logs.
232232

233233
```cs
234234
AssistantService service = new AssistantService("{version-date}");
@@ -248,6 +248,20 @@ catch(Exception e)
248248
}
249249
```
250250

251+
However, the transaction ID isn't available when the API doesn't return a response for some reason. In that case, you can set your own transaction ID in the request. For example, replace `<my-unique-transaction-id>` in the following example with a unique transaction ID.
252+
253+
```cs
254+
void Example()
255+
{
256+
IamAuthenticator authenticator = new IamAuthenticator(
257+
apikey: "{apikey}");
258+
var service = new AssistantService("{version-date}", authenticator);
259+
service.SetServiceUrl("{serviceUrl}");
260+
service.WithHeader("X-Global-Transaction-Id", "<my-unique-transaction-id>");
261+
var results = service.Message("{workspace-id}", "{message-request}");
262+
}
263+
```
264+
251265
## Use behind a proxy
252266
To use the SDK behind an HTTP proxy, you need to set either the `http_proxy` or `https_proxy` environment variable.
253267
You can set this in the application environment using:

0 commit comments

Comments
 (0)