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:
-
Set up API3 key for user in Looker
-
Admin → Users → Edit User → API3 Keys
-
Client ID and Secrets are used in the login request
-
-
Call Login endpoint to get Auth Token (valid for 1 hour) (POST /login)
- looker-sdk-ruby/authentication.md at master · looker/looker-sdk-ruby
-
POST - https://dashboards.harness.io:19999/api/4.0/login?client_id={clientId}&client_secret={clientSecret}
- curl -i -d “client_id={clientID}&client_secret={clientSecret}” https://dashboards.harness.io:19999/api/4.0/login
-
Get “access_token” from response (if status 200)
-
Tokens last 1 hour upon issue or until logged out manually with the /logout endpoint
-
DELETE - https://dashboards.harness.io:19999/api/4.0/logout
- curl -i -X DELETE -H “Authorization: token {authToken}” https://dashboards.harness.io:19999/api/4.0/logout
- curl -i -X DELETE -H “Authorization: token {authToken}” https://dashboards.harness.io:19999/api/4.0/logout
-
-
Get Dashboard Elements
-
https://dashboards.harness.io:19999/api/4.0/dashboards/3516/dashboard_elements
- curl -i -H “Authorization: token {authToken}” https://dashboards.harness.io:19999/api/4.0/dashboards/{dashboardId}/dashboard_elements
-
Get queryID of desired tile (response.data[0].query_id)
- 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”)
-
-
Run the query in format csv and download the result
-
https://dashboards.harness.io:19999/api/4.0/queries/327091/run/csv
-
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)