You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@eagle.apache.org by Daniel Zhou <Da...@dataguise.com> on 2015/12/15 01:22:52 UTC

API test

Hi all,

I called the eagle API to create a policy but ended with "HTTP Status 403 Access Denied".  I'm not sure if there is something wrong with the authorization part?
Here is how I called the policy definition API:
URL: http://centos.da2:9099/eagle-service/rest/entities?serviceName=AlertDefinitionService
Method: POST
Headers:
"Content-Type:application/json",
"Authorization: Basic YWRtaW46c2VjcmV0"    ( "admin:secret" is encoded to Base64 format, which is "YWRtaW46c2VjcmV0")
Data:
[{
                "tags": {
                                "site": "Demo",
                                "dataSource": "hdfsAuditLog",
                                "policyId": "testPolicy",
                                "alertExecutorId": "hdfsAuditLogAlertExecutor",
                                "policyType": "siddhiCEPEngine"
                },
                "desc": "test alert policy",
                "policyDef": {
                                "type": "siddhiCEPEngine",
                                "expression": "from hdfsAuditLogEventStream[src =='/test0'] select * insert into outputStream;"
                },
                "notificationDef": [{
                                "sender": "noreply-eagle@company.com",
                                "recipients": "user@company.com",
                                "subject": "test alert policy",
                                "flavor": "email",
                                "id": "email_1"
                }],
                "enabled": true
}]


Thanks,
Daniel