Setting up of looker dashboard

Continuing the discussion from Creating customer dashboards in harness using looker:

Steps of configuring the looker on harness:

Note: You would need to login using an API3 key that’s generated in Looker:

  1. Set up API3 key for user in Looker

    1. Admin → Users → Edit User → API3 Keys

    2. Client ID and Secrets are used in the login request

  2. Call Login endpoint to get Auth Token (valid for 1 hour) (POST /login)

    1. looker-sdk-ruby/authentication.md at master · looker/looker-sdk-ruby

    2. POST - https://dashboards.harness.io:19999/api/4.0/login?client_id={clientId}&client_secret={clientSecret}

      1. curl -i -d “client_id={clientID}&client_secret={clientSecret}” https://dashboards.harness.io:19999/api/4.0/login
    3. Get “access_token” from response (if status 200)

      1. Tokens last 1 hour upon issue or until logged out manually with the /logout endpoint

      2. DELETE - https://dashboards.harness.io:19999/api/4.0/logout

        1. curl -i -X DELETE -H “Authorization: token {authToken}” https://dashboards.harness.io:19999/api/4.0/logout
  3. Get Dashboard Elements

    1. https://dashboards.harness.io:19999/api/4.0/dashboards/3516/dashboard_elements

      1. curl -i -H “Authorization: token {authToken}” https://dashboards.harness.io:19999/api/4.0/dashboards/{dashboardId}/dashboard_elements
    2. Get queryID of desired tile (response.data[0].query_id)

      1. You can find the matching element in the returned array either through hard coding the first element, or searching for a matching title (“deploymentData”) / id / lookml_link_id (“Deployment duration by Applications”)
  4. Run the query in format csv and download the result

    1. https://dashboards.harness.io:19999/api/4.0/queries/327091/run/csv

    2. curl -i -H “Authorization: token {authToken}” https://dashboards.harness.io:19999/api/4.0/queries/{queryId}/run/csv --output query_results.csv

Once logged in an authentication token has been received the user can hit any of the looker endpoints directly (Log in)

3 Likes