You need to enable JavaScript to run this app.
Torch Log Service

Torch Log Service

Copy page
Download PDF
C++ SDK
Get SDK response information
Copy page
Download PDF
Get SDK response information
Torch Log Service (TLS) SDK for C++ offers a unified style of encapsulated responses for API actions. This topic describes how to get SDK response information.​
Getting the response fields​
Use response.fieldName to get the response fields of an API action described in API overview. Sample code:​
​
...​
auto response = client.DescribeProjects(request);​
printf("%d\n", response.total);​
...​
​
Getting the HTTP status code​
Use response.http_status_code to get the response code. Sample code:​
​
...​
auto response = client.DescribeProjects(request);​
printf("%d\n", response.http_status_code);​
...​
​
Getting the error information​
If the response code is not 200, use response.error_code and response.error_message to get the error code and error message returned by the TLS server for troubleshooting. Sample code:​
​
...​
auto response = client.DescribeProjects(request);​
printf("error_code: %s error_message: %s\n", response.error_code.c_str(), response.error_message.c_str());​
...​
​
Getting the request ID​
If you encounter an issue when calling a TLS API action and need help, contact TLS customer service support and provide the exception requestId recorded by response.request_id for a quick response. Sample code:​
​
...​
auto response = client.DescribeProjects(request);​
printf("request_id: %s\n", response.request_id.c_str());​
...​
​
Serializing a response to a JSON string​
The response objects of TLS SDK for C++ support using the GitHub - nlohmann/json: JSON for Modern C++ library for serialization and deserialization.​
This allows you to directly serialize the response to view the response clearly. Sample code:​
​
#include <ve-tls-cpp-sdk/thirdparty/nlohmann/json.hpp>​
​
...​
auto response = client.DescribeProjects(request);​
nlohmann::json j = response;​
printf("response: %s", j.dump().c_str());​
...​
​
​
Last updated: 2025.10.11 16:44:07