Qbrick

Type of Data

CDN Usage

Description

Monthly usage in GB for Qbrick CDN

Data Feed Format

A sample data feed of monthly usage looks like this:

      {
        "usage": {
        "unit": "GB",
        "value": "444706.06"
      }
    }
<!--NeedCopy-->

Implementation Notes

  • Usage metrics are captured.
  • Shows monthly usage metrics from beginning of month to current day (always based on the current month).
  • The monthly usage is received by hosting this request to the Qbrick API:

    {"metric":"size","tStart":1517443200000,"tEnd":2517443200000,"resolution":0}

  • Qbrick does the aggregation for the time range. The data returned is all usage between tStart and tEnd (in milliseconds). This calculation is internal to Qbrick.

Reconciliation Steps

There are several authentication methods provided by OAuth2.0. Qbrick suggests you use implicit grant flow to authenticate as a first step.

1. Retrieve the Authentication token

    POST https://video.qbrick.com/account/authentications
    headers: "Content-Type": "application/json"
    body : {"email": "[customer_email_here]", "password": "c[password_here]", "persistent": false}
<!--NeedCopy-->

cURL Request:

    curl "https://video.qbrick.com/account/authentications" -H 'Content-Type: application/json' -d '{"email": "[customer_email_here]", "password": "[password_here]", "persistent": false}'
<!--NeedCopy-->

The response is composed of your Account ID, Customer ID, and other information, including the generated “token”.

Response:

The response is composed of your Account ID, Customer ID, and other information, including the generated token.

    {
        "id": 123456,
        "uid": 123456,
        "token": "0e5f64267aff1cc48963b1f8995c76a1",
        "expiration": 1519226015000,
        "impersonate": -1,
        "customerId": 123456,
        "account": 123456
    }
<!--NeedCopy-->

Note: The Authentication token expiry is one week.

2. Retrieve the Access token

Use the following request to retrieve the access token:

    GET https://video.qbrick.com/authorization/oauth2/token?client_id=&authentication_token=&redirect_uri=http://video.qbrick.com/oauth.html&response_type=token
<!--NeedCopy-->

The server must answer with a 302 redirect, including the Location response header containing the URI used in the request, and the access-token.

Response:

    HTTP/1.1 302 Found
    Server: Apache-Coyote/1.1
    Location: http://video.qbrick.com/oauth.html#access_token=MjQ0ODEwN2MtNTQ3MS00MDJiLTgzNTctZmI2NTU5ZGIzZDJk&token_type=bearer&expires_in=3600
    Pragma: no-cache
    Cache-Control: no-cache, no-store, no-transform
    Content-Length: 0
    Date: Tue, 29 May 2018 22:00:42 GMT
    Set-Cookie: qvp-Tomcat-Farm=as260; path=/
<!--NeedCopy-->

3. Get Usage

    POST /api/v1/analytics/cdn/accounts/946645/stats?unit=gb HTTP/1.1
    Host: video.qbrick.com
    Authorization: Bearer NWM0NTU3NTUtZGZhMi00Y2UyLWJmNWQtYj43654635467354765
    Content-Type: application/json
    {"metric":"size","tStart":1517443200000,"tEnd":2517443200000,"resolution":0}
<!--NeedCopy-->

cURL Request:

    curl 'https://video.qbrick.com/api/v1/analytics/cdn/accounts/123456/stats?unit=gb' -H 'Authorization: Bearer NWM0NTU3NTUtZGZhMi00Y2UyLWJmNWQtYj43654635467354765' -H 'Content-Type: application/json' -d '{"metric":"size","tStart":1517443200000,"tEnd":2517443200000,"resolution":0}'
<!--NeedCopy-->

Where,

  • unit=gb is an option to get the value in GB. This is optional. If missing, the result is in Bytes “Metric”:”size” is usage
  • tStart is the time in millisecond since epoch. We set that to the first of the month at midnight.
  • tEnd is time in millisecond far in the future.
  • "Resolution": 0 is to get a single value for the time range specified.

The result looks like this:

    [
        {
            "tValue": 1517443200000,
            "value": 267594.852717525
        }
    ]
<!--NeedCopy-->

Where,

  • tValue is the beginning of a timeslot that we provided, that is, it is the first day of the month at midnight
  • value is the number of GB delivered since the tValue

Set up in Fusion

You can access Fusion Data Feeds from the left navigation pane, under Openmix. For initial steps refer to the Fusion Integration Documentation.

When you get to the service-specific configuration dialog box, the first step is to select the service you want to configure.

The next step is to fill out the following configuration fields:

  • Name: The name given to the data feed. This defaults to “Service - Platform Name” if not specified.
  • Run Every: How often the data feed is updated from the service.
  • Platform: The Platform that is associated with the data feed.
  • API User Email: This is the Qbrick user ID (email) used to log into Qbrick.
  • API Client ID: The type of data you are trying to retrieve such as load balancing statistics, Authentication statistics, DNS statistics
  • API Password: The API password for the user’s CDN account.
  • Account Number: The user’s Qbrick account number. It specifies the user’s CDN account.

Once the Qbrick Fusion configuration is complete, it is listed on the Fusion data feeds home page with a green status and monitoring metrics in the log history.

Data Feed History

You can view the data feed status, information about the data and the payload returned from the service. After selecting the specific data feed in the list, click Log History to show the history for the data feed.

Edit

To edit a Fusion data feed click the data feed in the list and then click the Edit button.

Once you’re done editing, click Save. This brings you back to the data feed list with your changes saved and applied to the data feed.

Qbrick