Skip to content

Commit 38f192f

Browse files
authored
docs: add instructions to get transaction id
1 parent a03a48c commit 38f192f

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,26 @@ Headers: "<http response headers>"
267267
Result: "<response returned by service>"
268268
```
269269

270+
### Transaction IDs
271+
Every SDK call will return a response which will contain a transaction ID, accessible via the `x-global-transaction-id` header. This transaction ID is useful for troubleshooting and accessing relevant logs from your service instance.
272+
273+
274+
```ruby
275+
require "ibm_watson"
276+
include IBMWatson
277+
278+
assistant = AssistantV1.new(
279+
authenticator: "<authenticator>"
280+
version: "2017-04-21"
281+
)
282+
283+
response = assistant.headers(
284+
"Custom-Header" => "custom_value"
285+
).list_workspaces
286+
287+
p "Global Transaction Id: #{response.headers["X-Global-Transaction-Id"]}"
288+
```
289+
270290
## Configuring the HTTP client
271291

272292
To set client configs like timeout or proxy use the `configure_http_client` function and pass in the configurations.
@@ -399,4 +419,4 @@ We'd love to highlight cool open-source projects that use this SDK! If you'd lik
399419
[license]: http://www.apache.org/licenses/LICENSE-2.0
400420
[vcap_services]: https://cloud.ibm.com/docs/services/watson?topic=watson-vcapServices
401421
[ibm-cloud-onboarding]: http://cloud.ibm.com/registration?target=/developer/watson&cm_sp=WatsonPlatform-WatsonServices-_-OnPageNavLink-IBMWatson_SDKs-_-Ruby
402-
[ivar]: http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/IVar.html
422+
[ivar]: http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/IVar.html

0 commit comments

Comments
 (0)