From 587a16da3137e19786f500c5c44d23b89ab29b15 Mon Sep 17 00:00:00 2001 From: Ajiemar Santiago Date: Fri, 30 Oct 2020 11:15:36 -0500 Subject: [PATCH 1/2] docs(readme): document how to set global transaction id --- README.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4f58b11d9..c44d0aa11 100755 --- a/README.md +++ b/README.md @@ -368,14 +368,15 @@ This would give an output of `DetailedResponse` having the structure: You can use the `get_result()`, `get_headers()` and get_status_code() to return the result, headers and status code respectively. ## Getting the transaction ID -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. +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. + ### Suceess ```python from ibm_watson import MyService service = MyService(authenticator=my_authenticator) response_headers = service.my_service_call().get_headers() -print(response_headers.get('x-global-transaction-id')) +print(response_headers.get('X-Global-Transaction-Id')) ``` ### Failure @@ -388,7 +389,16 @@ try: except ApiException as e: print(e.global_transaction_id) # OR - print(e.http_response.headers.get('x-global-transaction-id')) + print(e.http_response.headers.get('X-Global-Transaction-Id')) +``` + +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 in the following example with a unique transaction ID. + +```python +from ibm_watson import MyService + +service = MyService(authenticator=my_authenticator) +service.my_service_call(headers={'X-Global-Transaction-Id': ''}) ``` ## Using Websockets From 74eb3aaf1bdffd056f8ca437f9d829d4cd743a01 Mon Sep 17 00:00:00 2001 From: Ajiemar Santiago Date: Fri, 30 Oct 2020 11:45:16 -0500 Subject: [PATCH 2/2] docs: add missing backticks --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c44d0aa11..ce25e54dd 100755 --- a/README.md +++ b/README.md @@ -392,7 +392,7 @@ except ApiException as e: print(e.http_response.headers.get('X-Global-Transaction-Id')) ``` -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 in the following example with a unique transaction ID. +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 `` in the following example with a unique transaction ID. ```python from ibm_watson import MyService