Creating an Instance of ObsClient

If you have any questions during development, post them on the Issues page of GitHub. For details about parameters and usage of each API, see the API Reference.

ObsClient functions as the BrowserJS client for accessing OBS. It offers callers a series of APIs for interaction with OBS. These APIs are used for managing and operating resources, such as buckets and objects, stored in OBS. To use OBS BrowserJS SDK to send a request to OBS, you need to initialize an instance of ObsClient and modify parameters related to initial configurations of the instance based on actual needs.

Direction Creation

  • Sample code for creating an ObsClient instance using permanent access keys (AK/SK):
    // AMD is not introduced. Use the constructor to create an instance of ObsClient.
    var obsClient = new ObsClient({
           access_key_id: '*** Provide your Access Key ***',
           secret_access_key: '*** Provide your Secret Key ***',
           server : 'https://your-endpoint'
    });
    
    // Use the instance to access OBS.
  • Sample code for creating an ObsClient instance using temporary access keys (AK/SK and security token):
    // AMD is not introduced. Use the constructor to create an instance of ObsClient.
    var obsClient = new ObsClient({
           access_key_id: '*** Provide your Access Key ***',
           secret_access_key: '*** Provide your Secret Key ***',
           security_token: '*** Provide you  Security Token ***',
           server : 'https://your-endpoint'
    });
    
    // Use the instance to access OBS.

Creation According to AMD

  • Sample code for creating an ObsClient instance using permanent access keys (AK/SK):
    // AMD is introduced. Use the injected constructor to create an instance of ObsClient.
    var obsClient;
    define(['ObsClient'], function(ObsClient){
        obsClient = new ObsClient({
            access_key_id: '*** Provide your Access Key ***',
            secret_access_key: '*** Provide your Secret Key ***',
            server : 'https://your-endpoint'
        });
    
        // Use the instance to access OBS.
    });
  • Sample code for creating an ObsClient instance using temporary access keys (AK/SK and security token):
    // AMD is introduced. Use the injected constructor to create an instance of ObsClient.
    var obsClient;
    define(['ObsClient'], function(ObsClient){
        obsClient = new ObsClient({
            access_key_id: '*** Provide your Access Key ***',
            secret_access_key: '*** Provide your Secret Key ***',
            security_token: '*** Provide you  Security Token ***',
            server : 'https://your-endpoint'
        });
    
        // Use the instance to access OBS.
    });