SDK Common Response Headers

After you call an API in an instance of ObsClient, a sub-class of ObsWebServiceResponse will be returned. The sub-class contains information about HTTP/HTTPS response headers.

// Create an instance of ObsClient.
ObsClient client = new ObsClient("*** Provide your Access Key ***", "*** Provide your Secret Key ***", "https://your-endpoint");
// Create a bucket.
try
{
    CreateBucketRequest request = new CreateBucketRequest()
    {
        BucketName = "bucketname",
    };
    ObsWebServiceResponse response = client.CreateBucket(request);
    // Obtain the request ID from the public response headers.
    Console.WriteLine("RequestId: {0}", response.RequestId);
    foreach(KeyValuePair<string,string> entry in res.Headers)
    {
        Console.WriteLine("{0}:{1}", entry.Key, entry.Value);
    }
}
catch (ObsException ex)
{
    Console.WriteLine("ErrorCode: {0}", ex.ErrorCode);
    Console.WriteLine("ErrorMessage: {0}", ex.ErrorMessage);
}