Setting Access Endpoints

Last updated: 2020-09-11 11:28:59

    Overview

    This document describes how to request COS service using a domain/endpoint other than default COS endpoints.

    SDK API Reference

    For the parameters and method descriptions of all the APIs in the SDK, please see SDK API Reference.

    Default CDN Acceleration Domain Name

    For more information, see Enabling Default CDN Acceleration Domain Names.

    The sample code below shows how to access COS service using a default CDN acceleration domain name.

    Sample code

    Objective-C

    QCloudCOSXMLEndPoint *endpoint = [[QCloudCOSXMLEndPoint alloc] init];
    endpoint.suffix = @"file.myqcloud.com";

    Note:

    For the complete sample, go to GitHub.

    Swift

    let endpoint = QCloudCOSXMLEndPoint();
    endpoint.suffix = "file.myqcloud.com";

    Note:

    For the complete sample, go to GitHub.

    Custom CDN Acceleration Domain Name

    For more information, see Enabling Custom CDN Acceleration Domain Names.

    The sample code below shows how to access COS service using a custom CDN acceleration domain name.

    Sample code

    Objective-C

    QCloudCOSXMLEndPoint *endpoint = [[QCloudCOSXMLEndPoint alloc] initWithLiteralURL:[NSURL URLWithString:@"exampledomain.com"]];

    Note:

    For the complete sample, go to GitHub.

    Swift

    let endpoint = QCloudCOSXMLEndPoint.init(literalURL: NSURL.init(string: "exampledomain.com") as URL?);

    Note:

    For the complete sample, go to GitHub.

    Custom Endpoint

    For more information, see Enabling Custom Endpoints.

    The sample code below shows how to access COS service using a custom endpoint.

    Sample code

    Objective-C

    NSString *customDomain = @"exampledomain.com"; // Custom endpoint
    QCloudCOSXMLEndPoint *endpoint = [[QCloudCOSXMLEndPoint alloc] initWithLiteralURL:[NSURL URLWithString:customDomain]];

    Note:

    For the complete sample, go to GitHub.

    Swift

    let endpoint = QCloudCOSXMLEndPoint.init(literalURL: NSURL.init(string: "exampledomain.com") as URL?);

    Note:

    For the complete sample, go to GitHub.

    Global Acceleration Endpoint

    For more information on global acceleration, see Overview.

    The sample code below shows how to access COS service using a global acceleration endpoint.

    Sample code

    Objective-C

    QCloudCOSXMLEndPoint *endpoint = [[QCloudCOSXMLEndPoint alloc]init];
    endpoint.suffix = @"cos.accelerate.myqcloud.com";

    Note:

    For the complete sample, go to GitHub.
    Swift

    let endpoint = QCloudCOSXMLEndPoint();
    endpoint.suffix = "cos.accelerate.myqcloud.com";

    Note:

    For the complete sample, go to GitHub.

    Was this page helpful?

    Was this page helpful?

    • Not at all
    • Not very helpful
    • Somewhat helpful
    • Very helpful
    • Extremely helpful
    Send Feedback
    Help