Documentation

Mistake on this page? Email us

AccountApi

Hierarchy

  • ApiBase
    • AccountApi

Index

Constructors

constructor

  • Parameters

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

          • sdkError: SDKError
          • response: superagent.Response

          Returns any

    Returns AccountApi

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

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

v3MetricsGet

  • v3MetricsGet(include: string, interval: string, start?: string, end?: string, period?: string, limit?: number, after?: string, order?: string, callback?: function, requestOptions?: object): superagent.SuperAgentRequest
  • Provides account-specific statistics for other cloud services. This REST API is used to get account-specific statistics.

    Parameters

    • include: string

      A comma-separated list of requested metrics and total_count (if included, the response will contain total_count to specify the total number of records available). Supported values are: - `transactions` - `full_registrations` - `registration_updates` - `deleted_registrations` - `expired_registrations` - `bootstraps_successful` - `bootstraps_failed` - `bootstraps_pending` - `handshakes_successful` - `connect_rest_api_success` - `connect_rest_api_error` - `device_proxy_request_success` - `device_proxy_request_error` - `device_subscription_request_success` - `device_subscription_request_error` - `device_observations` - `total_count` Note: The metrics device_proxy_request_success, device_proxy_request_error, device_subscription_request_success, device_subscription_request_error and device_observations monitor only the response from the device to Mbed Cloud Connect and they do not confirm that the response is delivered to client callback urls used when you try to access device resources using Connect API endpoints. Example usage: ``` curl -X GET \ -H "Authorization : Bearer <valid access Token>" 'https://api.us-east-1.mbedcloud.com/v3/metrics?include=transactions,total_count&start=20170207&end=20170407&interval=1d&#39; { "object": "list", "limit": 20, "total_count": 54, "after": "2017-07-26T00:00:00Z", "has_more": true, "data": [ { "id": "015d8157c800015e306fffff005374617473000", "timestamp": "2017-07-27T00:00:00Z", "transactions": 27366 }, { "id": "015d867e2400015e306fffff005374617473000", "timestamp": "2017-07-28T00:00:00Z", "transactions": 27480 } ] } ```

    • interval: string

      Group the data by this interval in minutes, hours, days or weeks. Sample values: 5m, 2h, 3d, 4w. The maximum interval cannot exceed one year (365 days). The allowed ranges are 5m-525600m/1h-8760h/1d-365d/1w-53w.

    • Optional start: string

      UTC time/year/date in RFC3339 format. Fetch the data with timestamp greater than or equal to this value. Sample values: 20170207T092056990Z / 2017-02-07T09:20:56.990Z / 2017 / 20170207. The maximum time between start and end parameters cannot exceed more than one year (365 days). The parameter is not mandatory, if the period is specified.

    • Optional end: string

      UTC time/year/date in RFC3339 format. Fetch the data with timestamp less than this value.Sample values: 20170207T092056990Z / 2017-02-07T09:20:56.990Z / 2017 / 20170207. The maximum time between start and end parameters cannot exceed more than one year ( 365 days ). The parameter is not mandatory, if the period is specified.

    • Optional period: string

      Period. Fetch the data for the period in minutes, hours, days or weeks. Sample values: 5m, 2h, 3d, 4w. The parameter is not mandatory, if the start and end time are specified. The maximum period cannot exceed one year (365 days). The allowed ranges are 5m-525600m/1h-8760h/1d-365d/1w-53w.

    • Optional limit: number

      The number of results to return. The default value is 50, minimum 2 and maximum 1000.

    • Optional after: string

      The metric ID after which to start fetching. This also can be used for pagination as follows. Example usage: ``` curl -X GET \ -H "Authorization : Bearer <valid access Token>" 'https://api.us-east-1.mbedcloud.com/v3/metrics?include=transactions,total_count&start=20170707&end=20170829&interval=1d&limit=20&#39; { "object": "list", "limit": 20, "total_count": 54, "has_more": true, "data": [ { "id": "015d1a589800015e306fffff005374617473000", "timestamp": "2017-07-07T00:00:00Z", "transactions": 26381 }, . . . { "id": "015d7c316c00015e306fffff005374617473000", "timestamp": "2017-07-26T00:00:00Z", "transactions": 25569 } ] } ``` If the parameter “has more” is true, it indicates that the list is not complete and more values are available. You can give the last ID of the list as the value of the “after” query parameter, and you get the next page of values. You can keep doing this until “has more” is false. ``` curl -X GET \ -H "Authorization : Bearer <valid access Token>" 'https://api.us-east-1.mbedcloud.com/v3/metrics?include=transactions,total_count&start=20170707&end=20170829&interval=1d&limit=20&after=015d7c316c00015e306fffff005374617473000&#39; { "object": "list", "limit": 20, "total_count": 54, "after": "2017-07-26T00:00:00Z", "has_more": true, "data": [ { "id": "015d8157c800015e306fffff005374617473000", "timestamp": "2017-07-27T00:00:00Z", "transactions": 27366 }, . . . { "id": "015de3309c00015e306fffff005374617473000", "timestamp": "2017-08-15T00:00:00Z", "transactions": 24707 } ] } ```

    • Optional order: string

      The order of the records to return. Available values are ASC and DESC. The default value is ASC.

    • Optional callback: function
        • Parameters

          Returns any

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

    Returns superagent.SuperAgentRequest