--- a/readme.md
+++ b/readme.md
@@ -25,13 +25,17 @@
`On the browser please navigate to `localhost:5000` to reach the frontend module.`
Notification enabler will need the following Environment Variables:
-`PORT
-USEREMAIL
+`
+PORT
+USEREMAIL
USERPWD
DBUSER
DBPASSWORD
DATABASE
-DBCONLIMIT`
+DBDEBUG
+DBCONLIMIT
+EMAILON
+DEBUGLEVEL`
`This Environment Variables will be in data.env file, locate on the clone directory.`
@@ -58,50 +62,64 @@
"success": true,
"data": [
{
- "rulesID": 11,
- "description": "New Rule",
- "parameter": "slumptest",
+ "rulesID": ruleID,
+ "description": "Description",
+ "parameter": "Parameter",
+ "conditionValue": "Condition Value",
+ "controlValue": "Control Value",
+ "threshold": "Threshold",
+ "notifyType": "Notify Type",
+ "emailTo": "Emails",
+ "notificationType": notificationType,
+ "hostname": "Hostname",
+ "port": Port,
+ "path": "Path",
+ "method": "Method",
+ "token": "Token"
+ }
+ ]
+}
+```
+
+Use this API call whenever is needed to retrieve all rules related to vApp.
+
+#### Request
+`GET /api/vf-os-enabler/<api_version>/getRules/<app_id>`
+
+#### URL Parameters
+
+Resource Parameter | Description
+------------------ | -----------
+api_version | Identifies the API version that will be used for the request.
+app_id | Identifies the APP.
+
+
+#### Return Payload
+
+The API response will contain a JSON document with the property `success`: **true**, **false** and the `data` with the rules of app (if found).
+
+In the following Example it's queried all rules related to specific appID:
+
+
+```json
+{
+ "success": true,
+ "data": [
+ {
+ "rulesID": 1,
+ "description": "TR37",
+ "parameter": "TR37",
"conditionValue": ">",
- "controlValue": "5",
+ "controlValue": "37",
+ "threshold": "10",
+ "notifyType": "Email",
+ "emailTo": "miguel.rodrigues@knowledgebiz.pt,miguel.andre.rodrigues@gmail.com,ma.rodrigues@campus.fct.unl.pt",
"notificationType": 5,
- "token": "fgTJAyuX0M4tpn1P2WXAJmRbDH7hwbVhZsL26Ca1Ecm"
- }
- ]
-}
-```
-
-Use this API call whenever is needed to retrieve all rules related to vApp.
-
-#### Request
-`GET /api/vf-os-enabler/<api_version>/getRules/<app_id>`
-
-#### URL Parameters
-
-Resource Parameter | Description
------------------- | -----------
-api_version | Identifies the API version that will be used for the request.
-app_id | Identifies the APP.
-
-
-#### Return Payload
-
-The API response will contain a JSON document with the property `success`: **true**, **false** and the `data` with the rules of app (if found).
-
-In the following Example it's queried all rules related to specific appID:
-
-
-```json
-{
- "success": true,
- "data": [
- {
- "rulesID": 11,
- "description": "New Rule",
- "parameter": "slumptest",
- "conditionValue": ">",
- "controlValue": "5",
- "notificationType": 5,
- "token": "fgTJAyuX0M4tpn1P2WXAJmRbDH7hwbVhZsL26Ca1Ecm"
+ "hostname": "null",
+ "port": 0,
+ "path": "null",
+ "method": "null",
+ "token": "0ahobLza90bTxNPF9wBYVOtMCoPOD8DMonijqthUila"
}
]
}
@@ -133,10 +151,11 @@
"success": true,
"data": [
{
- "emailTo": "raquel.melo@knowledgebiz.pt",
- "subject": "slumptest>10",
- "date": "2018-04-27 12:06:02",
- "token": "fgTJAyuX0M4tpn1P2WXAJmRbDH7hwbVhZsL26Ca1Ecm"
+ "notificationID": 1,
+ "subject": "Subject = Value of subject",
+ "date": "2018-06-29T17:03:50.000Z",
+ "token": "0ahobLza90bTxNPF9wBYVOtMCoPOD8DMonijqthUila",
+ "rulesID": 2
}
]
}
@@ -166,34 +185,11 @@
"success": true,
"data": [
{
- "emailTo": "miguel.rodrigues@knowledgebiz.pt",
- "subject": "slumptest=40",
- "date": "2018-04-27 15:39:51",
- "token": "fgTJAyuX0M4tpn1P2WXAJmRbDH7hwbVhZsL26Ca1Ecm"
- },
- {
- "emailTo": "miguel.rodrigues@knowledgebiz.pt",
- "subject": "slumptest=40",
- "date": "2018-04-27 16:06:00",
- "token": "fgTJAyuX0M4tpn1P2WXAJmRbDH7hwbVhZsL26Ca1Ecm"
- },
- {
- "emailTo": "miguel.rodrigues@knowledgebiz.pt",
- "subject": "slumptest=40",
- "date": "2018-04-27 16:06:09",
- "token": "fgTJAyuX0M4tpn1P2WXAJmRbDH7hwbVhZsL26Ca1Ecm"
- },
- {
- "emailTo": "miguel.rodrigues@knowledgebiz.pt",
- "subject": "slumptest=40",
- "date": "2018-04-27 16:08:30",
- "token": "fgTJAyuX0M4tpn1P2WXAJmRbDH7hwbVhZsL26Ca1Ecm"
- },
- {
- "emailTo": "miguel.rodrigues@knowledgebiz.pt",
- "subject": "slumptest=40",
- "date": "2018-04-27 16:09:51",
- "token": "fgTJAyuX0M4tpn1P2WXAJmRbDH7hwbVhZsL26Ca1Ecm"
+ "notificationID": 1,
+ "subject": "TR37 = 100",
+ "date": "2018-06-29T17:03:50.000Z",
+ "token": "0ahobLza90bTxNPF9wBYVOtMCoPOD8DMonijqthUila",
+ "rulesID": 1
}
]
}
@@ -226,9 +222,9 @@
"success": true,
"data": [
{
- "token": "Es5zfsco57fieoQcDJZuIZxFZWv4HQbBYgUXRgqodQp",
- "appID": "myawesomeappid",
- "developerID": "david.aleixo@knowledgebiz.pt"
+ "token": "token",
+ "appID": "AppID",
+ "developerID": "DeveloperID"
}
]
}
@@ -258,9 +254,9 @@
"success": true,
"data": [
{
- "token": "Es5zfsco57fieoQcDJZuIZxFZWv4HQbBYgUXRgqodQp",
- "appID": "MiguelID",
- "developerID": "painatal_vodka@hotmail.com"
+ "token": "0ahobLza90bTxNPF9wBYVOtMCoPOD8DMonijqthUila",
+ "appID": "TR",
+ "developerID": "miguel.rodrigues@knowledgebiz.pt"
}
]
}
@@ -384,15 +380,11 @@
### Enabler 2 - Create Notifications
```http
-POST http://localhost:8000/api/vf-os-enabler/v0/notifications
+POST /api/vf-os-enabler/v0/notifications
Accept: */*
Content-Type: application/json; charset=utf-8
{
- "emailTo":[
- "my_email1",
- "my_email2"
- ],
"token":"my_token",
"body":[
{"subject":"my_Subject_1",
@@ -450,17 +442,12 @@
#### JSON Body Payload
Name | Required | Type | Description
-------- | ----------- | ------ | -----------
-emailTo | Yes | STRING | String where is the emails.
+------- | ----------- | ------ | -----------
token | Yes | STRING | String where is the token.
body | Yes | JSON | JSON document where is the subject and subjectValue.
Example of JSON body payload structure:
` {
- "emailTo": [
- "string",
- "string"
- ],
"token": "string",
"body": [
{
@@ -513,7 +500,7 @@
### Enabler 2 - Register vApp
```http
-POST http://localhost:8000/api/vf-os-enabler/v0/register
+POST /api/vf-os-enabler/v0/register
Accept: */*
Content-Type: application/json; charset=utf-8
@@ -597,18 +584,30 @@
### Enabler 2 - Create Rules
```http
-POST http://localhost:8000/api/vf-os-enabler/v0/notification/rules
+POST /api/vf-os-enabler/v0/notification/rules
Accept: */*
Content-Type: application/json; charset=utf-8
-{
- "appID":"my_appID",
- "description":"my_description",
- "parameter":"my_parameter",
- "conditionValue":"my_conditionValue",
- "controlValue":"my_controlValue",
- "notificationType":"my_notificationType"
-}
+[
+ {
+ appID: "AppID",
+ description: "Description",
+ parameter: "Parameter",
+ conditionValue: "Condition Value",
+ controlValue: "Control Value",
+ threshold: "Threshold",
+ notifyType: "Notify Type",
+ notificationType: "Notification Type",
+ hostname: "Hostname",
+ port: "Port",
+ path: "Path",
+ method: "Method",
+ emailTo:[
+ "emailTo_1",
+ "emailTo_2"
+ ]
+ }
+]
```
```http
@@ -643,18 +642,38 @@
description | Yes | STRING | String where is the description.
parameter | Yes | STRING | String where is the parameter for the rule.
conditionValue | Yes | STRING | String where is the conditionValue (>, <, >=, <=).
-controlValue | Yes | STRING | String where is the controlValue (Threshold).
+controlValue | Yes | STRING | String where is the controlValue.
+threshold | Yes | STRING | String where is the Threshold.
+notifyType | Yes | STRING | String where is the notifyType ("Email" or "HTTP Request").
notificationType | Yes | STRING | String where is the Notification Type (1 - Notify End of Month, 2 - Notify End of Two Weeks, 3 - Notify End of Week, 4 - Notify End of Three Days, 5 - Notify Immediately).
+hostname | Yes | STRING | String where is the Hostname.
+port | Yes | STRING | String where is the Port.
+path | Yes | STRING | String where is the Path.
+method | Yes | STRING | String where is the Method ("POST", "GET", "PUT" or "DELETE").
+emailTo | Yes | STRING | Array of Strings where is the emails.
Example of JSON body payload structure:
-` {
- "appID": "string",
- "description": "string",
- "parameter": "string",
- "conditionValue": "string",
- "controlValue": "string",
- "notificationType": "string"
- }`
+`[
+ {
+ "appID": "TR",
+ "description": "TR37",
+ "parameter": "TR37",
+ "conditionValue": ">",
+ "controlValue": "37",
+ "threshold": "10",
+ "notifyType": "Email",
+ "notificationType": 5,
+ "hostname": "null",
+ "port": 0,
+ "path": "null",
+ "method": "null",
+ "emailTo": [
+ "miguel.rodrigues@knowledgebiz.pt",
+ "miguel.andre.rodrigues@gmail.com",
+ "ma.rodrigues@campus.fct.unl.pt"
+ ]
+ }
+]`
#### Return Payload