Skip to content

Usage

Public API usage is restricted to the use of a licence.

Technical information are accessible on page workgroup administration, for users who are granted role workgrop administrator

Find Client Id

Necessary information for public api authentication :

  • API url (<base_url>) example : https://weu-mining-api.igrafxcloud.com
  • Authentication URL (<auth_url>) example : https://identity-emea.igrafxcloud.com/realms/logpickr-api-weu-mining
  • Technical ID of the workgroup (<client_id>)
  • Workgroup private key (<client_secret>)

General overview :

  • Generate an authentication token (limited duration)
  • Invoke a public API including valid this token as API header (header Authorization)

Token Generation

Example with curl:

curl -X POST \
  <auth_url>/protocol/openid-connect/token \
  --data "grant_type=client_credentials" \
  --data "client_id=<client_id>" \
  --data "client_secret=<client_secret>"
curl -X POST \
  https://identity-emea.igrafxcloud.com/realms/logpickr-api-weu-mining/protocol/openid-connect/token \
  --data "grant_type=client_credentials" \
  --data "client_id=1026d505-6945-4aa9-b3cd-08a368033a68" \
  --data "client_secret=b9c8872a-3109-40ef-9cdb-98a68b98441c"

This call will generate a json result :

{
  "upgraded":false,
  "access_token":"eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJyRGk5cE52elJCU01PQldVOUEtY0VLY0hwZ3Z5WGhoODRsZVBFbjF3TkVjIn0.eyJleHAiOjE1ODc2NTgwMzMsImlhdCI6MTU4NzY1NzczMywianRpIjoiYWIwYTA0OGUtMTM2My00ODBlLWFjNjAtZWIyZDAwZjk1ODZhIiwiaXNzIjoiaHR0cDovL2xvY2FsaG9zdDoyODA4MC9hdXRoL3JlYWxtcy9sb2dwaWNrciIsImF1ZCI6InNkay1hcGktYWNjZXNzIiwic3ViIjoiMmI3MDBmZDktZDExYy00ZjZmLWI1ZDctYWFmYTAzNzMwMDRmIiwidHlwIjoiQmVhcmVyIiwiYXpwIjoic2RrLWFwaS1hY2Nlc3MiLCJzZXNzaW9uX3N0YXRlIjoiNGM4NWYyMTItN2UzMC00M2E4LTg3N2QtY2Q0ZDE5NTY4Mjc2IiwiYWNyIjoiMSIsImFsbG93ZWQtb3Jp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in":1800,
  "refresh_token":"eyJhbGciOiJIUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJiZDMzY2UwOC1hMmJhLTQwNDItYTJmOC1iOTIwN2QxNzc4NDcifQ.eyJleHAiOjE1ODc2NTk1MzMsImlhdCI6MTU4NzY1NzczMywianRpIjoiNGVjZjJmZjktOWU3OC00OGEwLWE5NzQtZGVlMTZjMTYyMDE1IiwiaXNzIjoiaHR0cDovL2xvY2FsaG9zdDoyODA4MC9hdXRoL3JlYWxtcy9sb2dwaWNrciIsImF1ZCI6Imh0dHA6Ly9sb2NhbGhvc3Q6MjgwODAvYXV0aC9yZWFsbXMvbG9ncGlja3IiLCJzdWIiOiIyYjcwMGZkOS1kMTFjLTRmNmYtYjVkNy1hYWZhMDM3MzAwNGYiLCJ0eXAiOiJSZWZyZXNoIiwiYXpwIjoic2RrLWFwaS1hY2Nlc3MiLCJzZXNzaW9uX3N0YXRlIjoiNGM4NWYyMTItN2UzMC00M2E4LTg3N2QtY2Q0ZDE5NTY4Mjc2IiwiYXV0aG9yaXphdGlvbiI6eyJwZXJtaXNzaW9ucyI6W3sicnNpZCI6ImYxNTIyYzhkLTQ2ZTQtNDMzZC04NmJjLTBjMTk2MjIxMTE2ZiIsInJzbmFtZSI6IkRlZmF1bHQgUmVzb3VyY2UifV19LCJzY29wZSI6InByb2ZpbGUgZW1haWwifQ.fqNYxzppsCgoFWmY1KBw6_iFT377_njEqGM7KTPKjoE",
  "token_type":"Bearer",
  "not-before-policy":0,
  "session_state": "fb4e04b6-79f7-4d9d-aa49-5218f010cf67",
  "scope": "profile email mining-weu-ui-clientscope"
}

Reference : https://www.keycloak.org/docs/latest/authorization_services/#_service_pushing_claims

Public API Invocation

The value of access_token of previous call has to be extracted and pasted into Public Api header Authorization with the prefix Bearer.

Example :

curl -X GET "<base_url>/pub/projects" \
-H "accept: application/json" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJyRG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ZmFsc2UsInByZWZlcnJlZF91c2VybmFtZSI6InNlcnZpY2UtYWNjb3VudC1zZGstYXBpLWFjY2VzcyIsImNsaWVudEFkZHJlc3MiOiIxNzIuMzAuMC4xIn0.T9yzVUrkwKl8WGBzwbpsjmJNoobrg3yw55lAnygJYpuc1PFXcPI_FZ8Eg9zJLxRUr2nei2VNIrdFu2vm0SFsg49v4pxhGdCCvDmx9kACEmOfaazSYL_3fOAsluT6gJpT23dbsriYgRB8Kdb1-Bqeq31qVESOkxkJdR4ITKr0yO7Kp9NTWRL125K90SWvx5eOR6-oGD6ToowmN2WthOgbSGgWNpHykItiSV1C9V6r8cSwPKhWcl4WxjmQaBo4PRFglr9lAYWR4NqxR2kTk34ZVRAn47pyCeGnWCWUss0F-sFcOFvT5jDAQglcDMKF8Ev-Rm3dSCobEjS6GoyJbILpeQ"

JDBC Access

Public APIs can provide the list of tables you are allowed to access, additional complex queries can be performed directly via JDBC access.

SQL syntax to be used is described on the official Druid documentation

JDBC Driver to use is Avatica

Main url to provide to JDBC component will be : "jdbc:avatica:remote:url=http://<base_url>:8082/druid/v2/sql/avatica/"

Example : "jdbc:avatica:remote:url=http://api.pf1.logpickr.com:8082/druid/v2/sql/avatica/"

Login/password correspond to the credentials of the workgroup you are accessing.

  • login : the Technical ID of the workgroup (<client_id>), found in the workgroup admin API page (see above)
  • password : Workgroup private key (<client_secret>), found in the workgroup admin API page (see above)

More details : : https://druid.apache.org/docs/latest/querying/sql.html#jdbc

Table structures are described in next chapter

SDK Access

A SDK will be released soon to let you access Logpickr structures and queries via Python.