Documentation

Mistake on this page? Email us

PreSharedKeysApi

Hierarchy

  • ApiBase
    • PreSharedKeysApi

Index

Constructors

constructor

  • Parameters

    • Optional options: ConfigOptions
    • Default value responseHandler: function =¬†null
        • (sdkError: SDKError, response: superagent.Response): any
        • Parameters

          • sdkError: SDKError
          • response: superagent.Response

          Returns any

    Returns PreSharedKeysApi

Methods

complete

  • complete(error: any, response: any, acceptHeader: string, callback?: function): void
  • Parameters

    • error: any
    • response: any
    • acceptHeader: string
    • Optional callback: function
        • Parameters

          Returns any

    Returns void

currentConfig

  • currentConfig(): object
  • Returns the current configuration of this API module

    Returns object

    • apiKey: any
    • host: any

deletePreSharedKey

  • deletePreSharedKey(endpointName: string, callback?: function, requestOptions?: object): superagent.SuperAgentRequest
  • Remove a pre-shared key. Remove a pre-shared key. Example usage: ``` curl -H "authorization: Bearer ${API_TOKEN}" -X DELETE https://api.us-east-1.mbedcloud.com/v2/device-shared-keys/my-endpoint-0001 ```

    Parameters

    • endpointName: string

      The unique endpoint identifier that this pre-shared key applies to. Reserved characters must be percent-encoded.

    • Optional callback: function
        • (error: any, data?: any, response?: superagent.Response): any
        • Parameters

          • error: any
          • Optional data: any
          • Optional response: superagent.Response

          Returns any

    • Optional requestOptions: object
      • [key: string]: any

    Returns superagent.SuperAgentRequest

getPreSharedKey

  • getPreSharedKey(endpointName: string, callback?: function, requestOptions?: object): superagent.SuperAgentRequest
  • Get a pre-shared key. Check if a pre-shared key for an endpoint exists or not. The response does not contain the secret itself. Example usage: ``` curl -H "authorization: Bearer ${API_TOKEN}" https://api.us-east-1.mbedcloud.com/v2/device-shared-keys/my-endpoint-0001 ```

    Parameters

    • endpointName: string

      The unique endpoint identifier that this pre-shared key applies to. Reserved characters must be percent-encoded.

    • Optional callback: function
    • Optional requestOptions: object
      • [key: string]: any

    Returns superagent.SuperAgentRequest

listPreSharedKeys

  • listPreSharedKeys(limit?: number, after?: string, callback?: function, requestOptions?: object): superagent.SuperAgentRequest
  • List pre-shared keys. List pre-shared keys with pagination and default page size of 50 entries. Example usage: ``` curl -H "authorization: Bearer ${API_TOKEN}" https://api.us-east-1.mbedcloud.com/v2/device-shared-keys ```

    Parameters

    • Optional limit: number

      The number of entries per page

    • Optional after: string

      An offset token for fetching a specific page. Provided by the server.

    • Optional callback: function
    • Optional requestOptions: object
      • [key: string]: any

    Returns superagent.SuperAgentRequest

request

  • request<T>(options: object, callback?: function): superagent.SuperAgentRequest
  • Type parameters

    • T

    Parameters

    • options: object
      • acceptTypes: Array<string>
      • Optional body?: any
      • contentTypes: Array<string>
      • Optional file?: boolean
      • formParams: __type
      • headers: object
        • [key: string]: string
      • method: string
      • query: __type
      • Optional requestOptions?: object
        • [key: string]: any
      • url: string
      • useFormData: boolean
    • Optional callback: function
        • Parameters

          Returns any

    Returns superagent.SuperAgentRequest

uploadPreSharedKey

  • uploadPreSharedKey(body: PreSharedKey, callback?: function, requestOptions?: object): superagent.SuperAgentRequest
  • Upload a pre-shared key to Mbed Cloud. Upload a pre-shared key (PSK) for an endpoint to allow it to bootstrap. The existing key will not be overwritten but needs to be deleted first in case of re-setting PSK for an endpoint. Note: The PSK APIs are available only to accounts that have this feature enabled. Example usage: ``` curl -H &quot;authorization: Bearer ${API_TOKEN}&quot; -H &quot;content-type: application/json&quot; -X POST https://api.us-east-1.mbedcloud.com/v2/device-shared-keys \ -d '{&quot;endpoint_name&quot;: &quot;my-endpoint-0001&quot;, &quot;secret_hex&quot;: &quot;4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a&quot; }' ```

    Parameters

    • body: PreSharedKey

      Pre-shared key to be uploaded.

    • Optional callback: function
        • (error: any, data?: any, response?: superagent.Response): any
        • Parameters

          • error: any
          • Optional data: any
          • Optional response: superagent.Response

          Returns any

    • Optional requestOptions: object
      • [key: string]: any

    Returns superagent.SuperAgentRequest