API Keys
You can perform elemental tasks such as rule execution, starting a crawler, profiling an asset through direct API calls as well in addition to the existing UI interface. These sets of exposed APIs will be authenticated through a pair of ‘accessKey’ and ‘secretKey’ present in the API request header.
Creating API Keys
In order to gain access to the exposed APIs, generate a pair of ‘accessKey’ and ‘secretKey’ from the UI.
Go to the Settings page from the side navigation bar
This page will contain a list of API keys that are currently valid for the current user
‘Create Access Key’ button will publish a pair of new ‘accessKey’ and ‘secretKey’ against the current user.
note
This is the only time you can view or download the ‘secretKey’. They cannot be recovered later. However, you can create new keys at any time.
Examples
Rule Execution
Request
POST http://localhost:8888/api/webhook/rules/executions/:id
Request Parameters(mandatory)
- Headers
- accessKey(string)
- secretKey(string)
- Path parameters
- id - Rule Id(Rule should be enabled)
$ curl -X POST "http://localhost:8888/api/webhook/rules/executions/24" -H "accessKey: K2E32HK3A9NY" -H "secretKey: wrong_secret_key"
{"errors" : [{"details" : null, "message" : "Unauthorised:: Authorisation through API Keys failed", "status" : 401}]}
$ curl -X POST "http://localhost:8888/api/webhook/rules/executions/24" -H "accessKey: K2E32HK3A9NY" -H "secretKey: 8bXFZMtPizehms0AryHvFuBuwk5ZAR"
{"execution" : {"executionError" : null, "executionMode" : "API", "executionStatus" : "RUNNING", "finishedAt" : null, "id" : 119, "lastMarker" : null, "leftLastMarker" : null, "resultStatus" : "RUNNING", "rightLastMarker" : null, "ruleId" : 24, "ruleName" : "example_fb_policy", "ruleType" : "DATA_QUALITY", "startedAt" : "2021-01-31T20:59:33.610+05:30"}, "items" : [{"analyticsPipelineName" : "default", "businessItemId" : null, "error" : null, "executionId" : 119, "finishedAt" : null, "id" : 113, "requestId" : "d6677497-ec84-45d2-b7f0-1a3caadb9a25", "result" : null, "rowsFailed" : null, "rowsScanned" : null, "ruleItemId" : 22, "sparkClusterContext" : "LOCAL", "startedAt" : "2021-01-31T20:59:33.617+05:30", "threshold" : 100.0}]}
Rule Execution Response
{
"execution": {
"executionError": null,
"executionMode": "API",
"executionStatus": "RUNNING",
"finishedAt": null,
"id": 120,
"lastMarker": null,
"leftLastMarker": null,
"resultStatus": "RUNNING",
"rightLastMarker": null,
"ruleId": 24,
"ruleName": "example_fb_policy",
"ruleType": "DATA_QUALITY",
"startedAt": "2021-01-31T21:24:52.104+05:30"
},
"items": [
{
"analyticsPipelineName": "default",
"businessItemId": null,
"error": null,
"executionId": 120,
"finishedAt": null,
"id": 114,
"requestId": "d21dacc1-2532-4405-b909-9f689b531206",
"result": null,
"rowsFailed": null,
"rowsScanned": null,
"ruleItemId": 22,
"sparkClusterContext": "LOCAL",
"startedAt": "2021-01-31T21:24:52.121+05:30",
"threshold": 100.0
}
]
}
Incorrect API Key Response
{
"errors": [
{
"details": null,
"message": "Unauthorised:: Authorisation through API Keys failed",
"status": 401
}
]
}