Documentation

Mistake on this page? Email us

Hierarchy

  • BootstrapApi

Index

Constructors

constructor

  • The API can be initalized with a .env file in the wroking directory with the following values

    MBED_CLOUD_SDK_API_KEY=

    and optionally

    MBED_CLOUD_SDK_HOST= (defaults to https://api.us-east-1.mbedcloud.com)

    OR This API is initialized with ConnectionOptions.

    To create an instance of this API in Node.js:

    var PelionDMSDK = require("mbed-cloud-sdk");
    
    var bootstrap = new PelionDMSDK.BootstrapApi({
        apiKey: "<Pelion DM API Key>"
    });

    To create an instance of this API in the browser:

    <script src="<pelion-dm-sdk>/bundles/update.min.js"></script>
    
    <script>
        var bootstrap = new MbedCloudSDK.BootstrapApi({
            apiKey: "<Pelion DM API Key>"
        });
    </script>

    Parameters

    Returns BootstrapApi

Methods

addPsk

  • Set a device's pre-shared key.

    Example:

    bootstrap.addPsk({endpointName: 'abc', secretHex: 'secret'})
    .then(preSharedKey => {
        // success
    })
    .catch(error => {
        console.log(error);
    });

    Parameters

    Returns Promise<PreSharedKey>

    Promise of bootstrap claim

  • Set a device's pre-shared key.

    Example:

    bootstrap.addPsk({endpointName: 'abc', secretHex: 'secret'},
    function(error, preSharedKey) {
        if (error) throw error;
        // success
    });

    Parameters

    • preSharedKey: AddPreSharedKey
    • callback: CallbackFn<PreSharedKey>

      A function that is passed the arguments (error, presharedkey)

    Returns void

deletePsk

  • deletePsk(preSharedKey: string): Promise<void>
  • Delete a device's pre-shared key.

    Example:

    bootstrap.deletePsk('abc')
    .then(preSharedKey => {
        // success
    })
    .catch(error => {
        console.log(error);
    });

    Parameters

    • preSharedKey: string

      Claim details

    Returns Promise<void>

    Promise of bootstrap claim

  • deletePsk(preSharedKey: string, callback: CallbackFn<void>): void
  • Delete a device's pre-shared key.

    Example:

    bootstrap.deletePsk('abc',
    function(error, preSharedKey) {
        if (error) throw error;
        // success
    });

    Parameters

    • preSharedKey: string
    • callback: CallbackFn<void>

      A function that is passed the arguments (error, presharedkey)

    Returns void

getLastApiMetadata

  • getLastApiMetadata(): Promise<ApiMetadata>
  • Get meta data for the last Pelion Device Management API call

    Returns Promise<ApiMetadata>

    Promise of meta data

  • getLastApiMetadata(callback: CallbackFn<ApiMetadata>): void
  • Get meta data for the last Pelion Device Management API call

    Parameters

    • callback: CallbackFn<ApiMetadata>

      A function that is passed the arguments (error, meta data)

    Returns void

getPsk

  • getPsk(preSharedKey: string): Promise<PreSharedKey>
  • Get a device's pre-shared key

    note: the secretHex will not be included in the response

    Example:

    bootstrap.getPsk('abc')
    .then(preSharedKey => {
        // success
    })
    .catch(error => {
        console.log(error);
    });

    Parameters

    • preSharedKey: string

      Claim details

    Returns Promise<PreSharedKey>

    Promise of bootstrap claim

  • getPsk(preSharedKey: string, callback: CallbackFn<PreSharedKey>): void
  • Get a device's pre-shared key

    note: the secretHex will not be included in the response

    Example:

    bootstrap.getPsk('abc',
    function(error, preSharedKey) {
        if (error) throw error;
        // success
    });

    Parameters

    • preSharedKey: string
    • callback: CallbackFn<PreSharedKey>

      A function that is passed the arguments (error, presharedkey)

    Returns void

listPsks

  • List Psks

    Example:

    bootstrap.listPsks()
    .then(psks => {
        // Utilize psks here
    })
    .catch(error => {
        console.log(error);
    });

    Parameters

    Returns Promise<ListResponse<PreSharedKey>>

    Promise of listResponse

  • List Psks

    Example:

    bootstrap.listPsks(function(error, psks) {
        if (error) throw error;
        // Utilize psks here
    });

    Parameters

    Returns void