phenome_core.core.api module¶
Describes all REST API calls for the Phenome Core Agent.
-
api_add_relation(object_id, relation_ids, relation_type, details, request_id)¶ Creates a relationship between an object and a set of one or more other objects.
Example request:
GET /api/v1/add_relation/8/9+10/1/SampleText/51 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": [ { "object_id": "8", "relations": [ { "depends": false, "details": "SampleText", "enabled": true, "id": 2, "object_id_from": 8, "object_id_to": 9, "relation_type": 1 }, { "depends": false, "details": "SampleText", "enabled": true, "id": 3, "object_id_from": 8, "object_id_to": 10, "relation_type": 1 } ], "result": true } ], "error": "None", "request_id": 0, "status": 0 }
-
api_create_object(model_classtype, model_id, ip_address, mac_address, uniqueid, request_id)¶ Creates an object of model_classtype, model_id, and one or more of ip_address, mac_address, uniqueid
Example request:
GET /add_object/ENVIRONMENT_SENSOR/1/NONE/FF:00:00:00:00:FF/NONE/46 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": { "disabled": false, "id": 20, "ip": null, "mac": "FF:00:00:00:00:FF", "model_classname": "phenome.extensions.classtypes.ENVIRONMENT_SENSOR.base_sensor.BaseSensor", "model_classtype": 2, "model_id": 1, "model_name": "ROOT_SENSOR", "name": "FF:00:00:00:00:FF" }, "error": "None", "request_id": "46", "status": 0 }
- Statuscode 200
no error
- Statuscode 404
object could not be added
-
api_delete_object(object_id, model_id, ip_address, mac_address, request_id)¶ Deletes an object by ID, or a combination of model_id, ip_address, mac_address
Example request:
GET /delete_object/NONE/NONE/NONE/FF:00:00:00:00:FF/049 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": { "result": true }, "error": "None", "request_id": "049", "status": 0 }
- Statuscode 200
no error
- Statuscode 404
object could not be deleted
-
api_delete_relation(object_id, relation_ids, relation_type, request_id)¶ Deletes relationship(s) between an object and one or more other objects
Example request:
GET /api/v1/delete_relation/8/9/NONE/052 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": { "result": true }, "error": "None", "request_id": 0, "status": 0 }
-
api_execute_action_by_object(object_id, action_id, request_id)¶ Return all actions defined for a particular Object
Example request:
GET /api/v1/execute_action_by_object/<OBJECT_ID>/<ACTION_ID>/<REQUEST_ID> HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "status": 0, "error": "None", "core_version": "1.0.1", "api_version": 1, "data": [ { "actions": { "get_system_info": { "classname": "self", "methodname": "get_system_info", "show_in_ui": "true", "delay_secs": "1", "create_method": "True" } }, "ui_models": {}, "state_values": {}, "result": { "memory_total": 17179869184, "memory_util": 41.187477111816406, "disk_util": 76.3, "cpu_util": 20, "apps": { "core": { "appinfo": { "id": 0, "name": "core", "title": "holitics_core_agent", "version": "1.0.1", "description": "Open Source Platform Agent for core holitics applications", "classname": "phenome.core.api" } }, "minermedic": { "appinfo": { "id": 1, "name": "minermedic", "title": "MinerMedic", "version": "0.1.0", "description": "The Crypto Miner Management Platform", "classname": "minermedic.minermedic" } } } } } ], "request_id": "062" }
- Statuscode 200
no error
- Statuscode 404
no actions or object that match
-
api_get_actions_by_classtype(model_classtype, request_id)¶ Return all actions defined for a particular ClassType
Example request:
GET /api/v1/get_actions_by_classtype/POWER_DISTRIBUTION_UNIT/059 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": [ { "powercycle": { "classname": "self", "create_method": "True", "delay_secs": "30", "methodname": "powercycle", "show_in_ui": "true" }, "poweroff": { "classname": "self", "create_method": "True", "methodname": "poweroff", "required_property": "connected_outlet", "show_in_ui": "true" }, "poweron": { "classname": "self", "create_method": "True", "methodname": "poweron", "required_property": "connected_outlet", "show_in_ui": "true" } } ], "error": "None", "request_id": "059", "status": 0 }
- Statuscode 200
no error
- Statuscode 404
no actions or classtypes that match
-
api_get_actions_by_object(object_id, request_id)¶ Return all actions defined for a particular Object
Example request:
GET /api/v1/get_actions_by_object/OBJECT_ID/061 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": [ { "actions": { "powercycle": { "classname": "self", "create_method": "True", "delay_secs": "30", "description": "Power Cycle", "id": "powercycle", "methodname": "powercycle", "show_in_ui": "true", "ui_model": "generic_button" }, "poweroff": { "alter_state": "power_state", "classname": "self", "create_method": "True", "description": "Power Off", "force_state": "False", "id": "poweroff", "methodname": "poweroff", "required_property": "connected_outlet", "show_in_ui": "true", "state_enum": "_STATE_TYPES_", "target_state": "OFF", "ui_model": "power_toggle_button" }, "poweron": { "alter_state": "power_state", "classname": "self", "create_method": "True", "description": "Power On", "force_state": "False", "id": "poweron", "methodname": "poweron", "required_property": "connected_outlet", "show_in_ui": "true", "state_enum": "_STATE_TYPES_", "target_state": "ON", "ui_model": "power_toggle_button" } }, "enum_values": { "OFF": 1, "ON": 2 }, "state_values": { "power_state": 1 }, "ui_models": { "generic_button": { "id": "generic_button", "title": "", "type": "button" }, "power_toggle_button": { "data-offstyle": "danger", "data-onstyle": "success", "data_off": "OFF", "data_on": "ON", "id": "power_toggle_button", "title": "Power", "type": "toggle_button" } } } ], "error": "None", "request_id": "007", "status": 0 }
- Statuscode 200
no error
- Statuscode 404
no actions for this object
-
api_get_actions_by_object_model(model_id, request_id)¶ Return all actions defined for a particular Model
Example request:
GET /api/v1/get_actions_by_objectmodel/MODEL_ID/060 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": [ { "discover": { "classname": "self", "create_method": "True", "delay_secs": "30", "methodname": "discover", "show_in_ui": "true" }, "get_system_info": { "classname": "self", "create_method": "True", "delay_secs": "30", "methodname": "get_system_info", "show_in_ui": "true" }, "update": { "classname": "self", "create_method": "True", "methodname": "update", "show_in_ui": "true" } } ], "error": "None", "request_id": "060", "status": 0 }
- Statuscode 200
no error
- Statuscode 404
no actions or models that match
-
api_get_active_predictions_by_object(object_id, request_id)¶ Return Active Predictions By Object
Example request:
GET get_active_predictions_by_object/9/78 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": [ { "metric_id": "metric_one", "model_id": "model_one", "object_id": 9, "value": 56.0, "value_predicted": 55.0, "time_period": 1, "timestamp": 1576779600000 }, { "metric_id": "metric_two", "model_id": "model_two", "object_id": 9, "value": 66.0, "value_predicted": 65.0, "time_period": 1, "timestamp": 1576779600000 } ], "error": "None", "request_id": "078", "status": 0 }
- Statuscode 200
no error
- Statuscode 404
no data being predicted for this object
-
api_get_core_status(request_id)¶ Returns statistics for Core Agent
Example request:
GET /api/v1/get_core_status/036 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": [ { "cpu_util": 5, "datasets_memory_detail": { "TEST_RESULTS": 356 }, "datasets_memory_total": 356, "datasets_total": 1, "disk_util": 2, "memory_total": 1000000000, "memory_util": 10, "network_util": 0 } ], "error": "None", "request_id": "036", "status": 0 }
- Statuscode 200
no error
-
api_get_datamodel_aggregated(model_name, period, group_columns, data_columns, decorate, request_id)¶ Returns all aggregated model data for a named model.
Example request:
GET /api/v1/get_datamodel_aggregated_data/TEST_RESULTS/3/object_id+result_five/ALL/1 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": [ { "info": { "descriptions": { "result_one": "result # 1", "result_two": "result # 2", "result_three": "result # 3", "result_four": "result # 4", "result_five": "result # 5" }, "estimated": true, "index": [ "object_id", "result_five" ], "period": "HOUR", "result_count": 1 }, "keys": { "object_id": { "1": 1 }, "result_five": { "1": "GENERIC_DEVICE" } }, "results": { "object_id": { "[1,1]": 1 }, "result_five": { "[1,1]": "GENERIC_DEVICE" }, "result_four": { "[1,1]": 8 }, "result_one": { "[1,1]": 1.5 }, "result_three": { "[1,1]": 3 }, "result_two": { "[1,1]": 180.0 }, "time_period": { "[1,1]": 1 }, "timestamp_count": { "[1,1]": 2 }, "timestamp_max": { "[1,1]": 1533642720000 }, "timestamp_min": { "[1,1]": 1533642720000 } } } ], "error": "None", "request_id": 0, "status": 0 }
- Statuscode 200
no error
- Statuscode 404
no aggregated data results for that series
-
api_get_datamodel_raw_data(model_name, period_start, period_end, objects, data_columns, decorate, request_id)¶ Returns all raw model data for a named model.
Example request:
GET /api/v1/get_datamodel_data/GENERIC_SYSTEM/1/ALL/1+3+55/memory_util+cpu_util+object_id/0/041 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": [ { "results": { "cpu_util": { "0": 10, "1": 11, "2": 13, "3": 16, "4": 20, "5": 25, "6": 31, "7": 38, "8": 46, "9": 55, "10": 40, "11": 41, "12": 43, "13": 46, "14": 50, "15": 55, "16": 61, "17": 68, "18": 76, "19": 85 }, "memory_util": { "0": 20, "1": 21, "2": 23, "3": 26, "4": 30, "5": 35, "6": 41, "7": 48, "8": 56, "9": 65, "10": 5, "11": 6, "12": 8, "13": 11, "14": 15, "15": 20, "16": 26, "17": 33, "18": 41, "19": 50 }, "object_id": { "0": 1, "1": 1, "2": 1, "3": 1, "4": 1, "5": 1, "6": 1, "7": 1, "8": 1, "9": 1, "10": 2, "11": 2, "12": 2, "13": 2, "14": 2, "15": 2, "16": 2, "17": 2, "18": 2, "19": 2 } } } ], "error": "None", "request_id": "044", "status": 0 }
- Statuscode 200
no error
- Statuscode 404
no aggregated data results for that series
-
api_get_default_propertyvalues_by_classtype_and_property(model_classtype, property_name, request_id)¶ Returns all default Property Values for all Models Matching a ClassType and Property Name
Example request:
GET /api/v1/get_default_propertyvalues_by_classtype_and_name/1/test_property_model/020 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": [ { "default_value": "12345", "id": 8, "model": "TEST_MODEL", "name": "test_property_model", "value_blob": null, "value_int": 45678, "value_numeric": null, "value_real": null, "value_text": null } ], "error": "None", "request_id": "020", "status": 0 }
- Statuscode 200
no error
- Statuscode 404
no models that match
-
api_get_enum_by_id(enum_id, request_id)¶ Return ENUM by ID
Example request:
GET /api/v1/get_enum_by_id/_RELATION_TYPES_/065 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": [ { "_RELATION_TYPES_": { "ABOVE": 11, "BELOW": 12, "CHILD_OF": 100, "CONTAINS": 1, "EAST_OF": 9, "FAR_FROM": 15, "INSIDE_OF": 3, "LEFT_OF": 6, "MEMBER_OF": 14, "NEAR_TO": 16, "NEIGHBOR_OF": 13, "NORTH_OF": 7, "OUTSIDE_OF": 4, "PARENT_OF": 101, "PART_OF": 2, "PLUGGED_INTO_OUTLET": 1000, "PLUGGED_INTO_PORT": 1001, "RELATED_TO": 103, "RIGHT_OF": 5, "SIBLING_OF": 102, "SOUTH_OF": 8, "WEST_OF": 10 } } ], "error": "None", "request_id": "068", "status": 0 }
- Statuscode 200
no error
- Statuscode 404
no models that match
-
api_get_healthscores(request_id)¶ Returns healthscores and some key information for all objects currently being monitored by Core Agent.
Each record will return 6 values: object_id, healthscore, object_name, object_model_id, object_model_classtype, object_power_state
Example request:
GET /api/v1/get_healthscores/0 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": [ { "t0": [ 6, 1, "OBJECT_1", 7, 4, -1 ] }, { "t0": [ 7, 1, "OBJECT_2", 8, 2, 0 ] }, { "t0": [ 8, 1, "OBJECT_3", 8, 2, 0 ] } ], "error": "None", "request_id": "0", "status": 0 }
- Statuscode 200
no error
- Statuscode 404
no properties that match
-
api_get_model_classtype_id_by_name(model_classtype, request_id)¶ Return Model ClassType ID by Name
Example request:
GET /api/v1/get_model_classtype_id_by_name/GENERIC_DEVICE/013 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": { "value": 1 }, "error": "None", "request_id": "013", "status": 0 }
- Statuscode 200
no error
- Statuscode 404
no models that match
-
api_get_model_classtypes(app_id, details, request_id)¶ Return Model ClassTypes
For App_ID - specify 0 / ALL or specify specific application name to get classtypes only for that application For Details - specify 0 for no details or 1 to send all details for classtypes.
Example request:
GET /api/v1/get_model_classtypes/ALL/0/0 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": [ { "id": "OBJECT", "value": [ { "description": "Object", "icon": "", "value": "0" } ] }, { "id": "GENERIC_SYSTEM", "value": [ { "description": "Generic System", "value": "4" } ] }, { "id": "GENERIC_DEVICE", "value": [ { "description": "Generic Device", "value": "1" } ] }, { "id": "ENVIRONMENT_SENSOR", "value": [ { "description": "Environment Sensor", "icon": "sensor_environment.png", "value": "2" } ] }, { "id": "POWER_DISTRIBUTION_UNIT", "value": [ { "description": "Power Distribution Unit", "value": "3" } ] } ], "error": "None", "request_id": "65", "status": 0 }
- Statuscode 200
no error
- Statuscode 404
no classtypes that match for specified APP ID
-
api_get_model_subclasstypes(app_id, details, request_id)¶ Return Model SubClassTypes
For App_ID - specify 0 / ALL or specify specific application name to get subclasstypes only for that application For Details - specify 0 for no details or 1 to send all details for subclasstypes.
Example request:
GET /api/v1/get_model_subclasstypes/ALL/1/0 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": [ { "id": "SMART_PDU", "value": [ { "description": "Smart PDU", "icon": "", "value": "1" } ] }, { "id": "SMART_PLUG", "value": [ { "description": "Smart Plug", "value": "2" } ] } ], "error": "None", "request_id": "66", "status": 0 }
- Statuscode 200
no error
- Statuscode 404
no subclasstypes that match for specified APP ID
-
api_get_object_by_id(id, verbose, request_id)¶ Return a specific object or objects by ID
Example request:
GET /api/v1/get_object_by_id/9/1/6 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": { "disabled": false, "id": 9, "ip": null, "mac": "AA:BB:CC:DD:EE:FF", "model_classname": "phenome.testclassname", "model_classtype": 1, "model_id": 3, "model_name": "TEST_MODEL", "properties": [ { "id": 226, "name": "test_property_model", "value": 45678 } ], "relations": [ { "disabled": false, "id": 10, "ip": "127.0.0.1", "mac": null, "model_id": 3 } ] }, "error": "None", "request_id": "6", "status": 0 }
- Statuscode 200
no error
- Statuscode 404
no objects that match
-
api_get_object_by_ip(ip_address, verbose, request_id)¶ Returns objects by IP address
Example request:
GET /api/v1/get_object_by_ip/127.0.0.1/1/004 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": { "disabled": false, "id": 10, "ip": "127.0.0.1", "mac": null, "model_classname": "phenome.testclassname", "model_classtype": 1, "model_id": 3, "model_name": "TEST_MODEL", "properties": [ { "id": 227, "name": "test_property_model", "value": 45678 } ], "relations": [ { "disabled": false, "id": 9, "ip": null, "mac": "AA:BB:CC:DD:EE:FF", "model_id": 3 } ] }, "error": "None", "request_id": "004", "status": 0 }
- Statuscode 200
no error
- Statuscode 404
no objects that match
-
api_get_object_by_ip_and_mac(ip_address, mac_address, verbose, request_id)¶ Return objects with a specific IP and MAC
Example request:
GET /api/v1/get_object_by_ip_and_mac/127.0.0.1/AA:BB:CC:DD:EE:FF/1/007 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": {}, "error": "No object", "request_id": "007", "status": 2 }
- Statuscode 200
no error
- Statuscode 404
no objects that match
-
api_get_object_by_ip_and_model_id(ip_address, model_id, verbose, request_id)¶ Return objects with a specific IP and Model ID
Example request:
GET /api/v1/get_object_by_ip_and_model_id/127.0.0.1/3/1/008 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": { "disabled": false, "id": 10, "ip": "127.0.0.1", "mac": null, "model_classname": "phenome.testclassname", "model_classtype": 1, "model_id": 3, "model_name": "TEST_MODEL", "properties": [ { "id": 227, "name": "test_property_model", "value": 45678 } ], "relations": [ { "disabled": false, "id": 9, "ip": null, "mac": "AA:BB:CC:DD:EE:FF", "model_id": 3 } ] }, "error": "None", "request_id": "008", "status": 0 }
- Statuscode 200
no error
- Statuscode 404
no objects that match
-
api_get_object_by_mac(mac_address, verbose, request_id)¶ Returns objects by MAC address
Example request:
GET /api/v1/get_object_by_mac/AA:BB:CC:DD:EE:FF/1/5 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": { "disabled": false, "id": 9, "ip": null, "mac": "AA:BB:CC:DD:EE:FF", "model_classname": "phenome.testclassname", "model_classtype": 1, "model_id": 3, "model_name": "TEST_MODEL", "properties": [ { "id": 226, "name": "test_property_model", "value": 45678 } ], "relations": [ { "disabled": false, "id": 10, "ip": "127.0.0.1", "mac": null, "model_id": 3 } ] }, "error": "None", "request_id": "5", "status": 0 }
- Statuscode 200
no error
- Statuscode 404
no objects that match
-
api_get_object_by_mac_and_model_id(mac_address, model_id, verbose, request_id)¶ Return objects with a specific MAC and Model ID
Example request:
GET /api/v1/get_object_by_mac_and_model_id/AA:BB:CC:DD:EE:FF/3/1/009 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": { "disabled": false, "id": 9, "ip": null, "mac": "AA:BB:CC:DD:EE:FF", "model_classname": "phenome.testclassname", "model_classtype": 1, "model_id": 3, "model_name": "TEST_MODEL", "properties": [ { "id": 226, "name": "test_property_model", "value": 45678 } ], "relations": [ { "disabled": false, "id": 10, "ip": "127.0.0.1", "mac": null, "model_id": 3 } ] }, "error": "None", "request_id": "009", "status": 0 }
- Statuscode 200
no error
- Statuscode 404
no objects that match
-
api_get_object_properties(object_id, verbose, request_id)¶ Return Object Properties by Object ID
Example request:
GET /api/v1/get_object_properties/9/016 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": [ { "enum_values": {}, "properties": [ { "description": "property_description_1", "id": 1, "name": "property_1", "value": 1234 }, { "description": "property_description_2", "id": 2, "name": "property_2", "value": 5678 } ] } ], "error": "None", "request_id": "016", "status": 0 }
- Statuscode 200
no error
- Statuscode 404
no objects that match
-
api_get_object_property_value(object_id, property_name, request_id)¶ Return Object Property by ID and Name
Example request:
GET /api/v1/get_object_property_value/9/test_property_model/015 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": { "test_property_model": 45678 }, "error": "None", "request_id": "015", "status": 0 }
- Statuscode 200
no error
- Statuscode 404
no properties that match
-
api_get_objectmodel_by_id(model_id, request_id)¶ Return Object Model by ID
Example request:
GET /api/v1/get_objectmodel_by_id/3/017 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": { "description": "This is a test Model", "id": 3, "model": "TEST_MODEL", "model_classname": "phenome.testclassname", "model_classtype": 1 }, "error": "None", "request_id": "017", "status": 0 }
- Statuscode 200
no error
- Statuscode 404
no models that match
-
api_get_objectmodel_by_name(model_name, request_id)¶ Return Object Model by Name
Example request:
GET /api/v1/get_objectmodel_by_name/TEST_MODEL/018 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": { "description": "This is a test Model", "id": 3, "model": "TEST_MODEL", "model_classname": "phenome.testclassname", "model_classtype": 1 }, "error": "None", "request_id": "018", "status": 0 }
- Statuscode 200
no error
- Statuscode 404
no models that match
-
api_get_objectmodels_by_classtype(model_classtype, request_id)¶ Returns all Object Models by ClassType
Example request:
GET /api/v1/get_objectmodels_by_classtype/GENERIC_DEVICE/022 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": [ { "description": "This is a test Model", "id": 3, "model": "TEST_MODEL", "model_classname": "phenome.testclassname", "model_classtype": 1 } ], "error": "None", "request_id": "022", "status": 0 }
- Statuscode 200
no error
- Statuscode 404
no models that match
-
api_get_objectmodels_by_subclasstype(model_subclasstype, request_id)¶ Returns all Object Models by SubClassType
Example request:
GET /api/v1/get_objectmodels_by_classtype/ /022 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": [ { "description": "Test Sensor for Unit Tests", "id": 31, "model": "TEST_SENSOR", "model_classname": "phenome.test.supporting.test_sensor.TestSensor", "model_classtype": 2, "model_subclasstype": 1000000 } ], "error": "None", "request_id": "067", "status": 0 }
- Statuscode 200
no error
- Statuscode 404
no models that match
-
api_get_objects(verbose, request_id)¶ Returns all objects in the system
Example request:
GET /api/v1/get_objects/0/002 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": [ { "disabled": false, "id": 11, "ip": null, "mac": "AA:BB:CC:DD:EE:FF", "model_id": 3 }, { "disabled": false, "id": 12, "ip": "127.0.0.1", "mac": null, "model_id": 3 }, { "disabled": false, "id": 4, "ip": "192.168.1.232", "mac": null, "model_id": 5 }, { "disabled": false, "id": 3, "ip": "192.168.1.234", "mac": null, "model_id": 6 }, { "disabled": false, "id": 5, "ip": "192.168.1.233", "mac": "00:00:00:00:00", "model_id": 7 }, { "disabled": false, "id": 6, "ip": "192.168.1.247", "mac": null, "model_id": 13 }, { "disabled": false, "id": 9, "ip": "192.168.1.223", "mac": null, "model_id": 17 }, { "disabled": false, "id": 10, "ip": "192.168.1.224", "mac": "00:00:00:00:00", "model_id": 17 }, { "disabled": false, "id": 7, "ip": null, "mac": "BC:2C:6A:1E:59:3D", "model_id": 18 }, { "disabled": false, "id": 8, "ip": null, "mac": "AA:2C:6A:1E:59:3D", "model_id": 18 } ], "error": "None", "request_id": "002", "status": 0 }
- Statuscode 200
no error
- Statuscode 404
no objects exist
-
api_get_objects_by_ip_and_model_classtype(ip_address, model_classtype, verbose, request_id)¶ Return objects with a specific IP and Model ClassType
Example request:
GET /api/v1/get_objects_by_ip_and_model_classtype/127.0.0.1/GENERIC_DEVICE/0/010 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": [ { "disabled": false, "id": 10, "ip": "127.0.0.1", "mac": null, "model_id": 3 } ], "error": "None", "request_id": "010", "status": 0 }
- Statuscode 200
no error
- Statuscode 404
no objects that match
-
api_get_objects_by_mac_and_model_classtype(mac_address, model_classtype, verbose, request_id)¶ Return objects with a specific MAC and Model ClassType
Example request:
GET /api/v1/get_objects_by_mac_and_model_classtype/AA:BB:CC:DD:EE:FF/GENERIC_DEVICE/0/011 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": [ { "disabled": false, "id": 9, "ip": null, "mac": "AA:BB:CC:DD:EE:FF", "model_id": 3 } ], "error": "None", "request_id": "011", "status": 0 }
- Statuscode 200
no error
- Statuscode 404
no objects that match
-
api_get_objects_by_model_classtype(model_classtype, verbose, request_id)¶ Returns objects of a specific Model ClassType
Example request:
GET /api/v1/get_objects_by_model_classtype/GENERIC_DEVICE/0/002 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": [ { "disabled": false, "id": 9, "ip": null, "mac": "AA:BB:CC:DD:EE:FF", "model_id": 3 }, { "disabled": false, "id": 10, "ip": "127.0.0.1", "mac": null, "model_id": 3 } ], "error": "None", "request_id": "002", "status": 0 }
- Statuscode 200
no error
- Statuscode 404
no objects that match
-
api_get_objects_by_model_id(model_id, verbose, request_id)¶ Returns objects of a specific Model ID
Example request:
GET /api/v1/get_objects_by_model_id/3/0/001 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": [ { "disabled": false, "id": 9, "ip": null, "mac": "AA:BB:CC:DD:EE:FF", "model_id": 3 }, { "disabled": false, "id": 10, "ip": "127.0.0.1", "mac": null, "model_id": 3 } ], "error": "None", "request_id": "001", "status": 0 }
- Statuscode 200
no error
- Statuscode 404
no objects that match
-
api_get_objects_by_model_subclasstype(model_subclasstype, verbose, request_id)¶ Returns objects of a specific Model SubClassType
Example request:
GET /api/v1/get_objects_by_model_subclasstype/CORE_AGENT/1/068 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": [ { "disabled": false, "id": 5, "ip": "0.0.0.0", "mac": "a0:99:9b:1d:e2:99", "model_classname": "phenome.extensions.classtypes.HOLITICS_AGENT.core_agent.CoreAgent", "model_classtype": 4, "model_id": 7, "model_name": "HOLITICS_CORE_AGENT", "name": "SELF", "properties": [ { "description": "Name for the object (defaults to unique_id)", "id": 47, "name": "name", "value": "SELF" }, { "description": "Icon representing the object", "id": 48, "name": "icon", "value": "" }, { "description": "Health of the object (0=healthy, 10=sick)", "id": 49, "name": "health", "value": 0 }, { "description": "Last time the object was down (time/milliseconds)", "id": 50, "name": "last_unreachable_time", "value": 0 }, { "description": "Last time the system sent notification (time/milliseconds)", "id": 51, "name": "last_notify_time", "value": 0 }, { "description": "Username to authenticate", "id": 52, "name": "username", "value": "username" }, { "description": "Password to authenticate", "id": 53, "name": "password", "value": "password" }, { "description": "Utilization which triggers a negative addition to health score (percentage)", "id": 54, "name": "utilization_threshold", "value": 75 }, { "description": "Checks overall utilization", "id": 55, "name": "check_utilization", "value": "" }, { "description": "The version of hardware this agent is running", "id": 56, "name": "hardware_version", "value": 0 }, { "description": "The version of software this agent is running", "id": 57, "name": "software_version", "value": "1.0" } ], "relations_from": [], "relations_to": [] } ], "error": "None", "request_id": "068", "status": 0 }
- Statuscode 200
no error
- Statuscode 404
no objects that match
-
api_get_predictivemodel_stats_by_classtype(model_classtype, request_id)¶ Return Predictive Model Statistics by ClassType
Example request:
GET /api/v1/get_predictivemodel_stats/ENVIRONMENT_SENSOR/05 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": [ { "health": { "ONE_MINUTE": { "accuracy": 93.439529181029684, "last_error": "", "last_update_time": 1570743242684, "rmse": 1.30753326416015625, "state": "TESTING" } }, "profitability": { "ONE_MINUTE": { "accuracy": -1, "last_error": "NO TRAINING DATA AVAILABLE", "last_update_time": 0, "rmse": null, "state": "INITIALIZED" } } } ], "error": "None", "request_id": "070", "status": 0 }
- Statuscode 200
no error
- Statuscode 404
no models that match
-
api_get_properties_by_objectmodel(model_id, request_id)¶ Returns all Properties for an Object Model with ID
Example request:
GET /get_properties_by_objectmodel/3/026 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": [ { "id": 1, "name": "test_property_model", "value": 45678 }, { "id": 2, "name": "test_property_model", "value": 45678 }, { "id": 3, "name": "test_property_model", "value": 45678 } ], "error": "None", "request_id": "026", "status": 0 }
- Statuscode 200
no error
- Statuscode 404
no properties that match
-
api_get_propertymodels_by_classtype(model_classtype, request_id)¶ Return Property Model by ClassType
Example request:
GET /api/v1/get_propertymodels_by_classtype/ENVIRONMENT_SENSOR/019 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": [ { "default_value": "0", "id": 1, "model": "ROOT_SENSOR", "model_classtype": 2, "name": "health" }, { "default_value": "80", "id": 2, "model": "ROOT_SENSOR", "model_classtype": 2, "name": "temp_warning" }, { "default_value": "90", "id": 3, "model": "ROOT_SENSOR", "model_classtype": 2, "name": "temp_error" }, { "default_value": "0", "id": 4, "model": "ROOT_SENSOR", "model_classtype": 2, "name": "last_temp_error_time" }, { "default_value": "0", "id": 5, "model": "ROOT_SENSOR", "model_classtype": 2, "name": "last_notify_time" }, { "default_value": "0", "id": 373, "model": "SENSOR_RuuviTag", "model_classtype": 2, "name": "health" }, { "default_value": "80", "id": 374, "model": "SENSOR_RuuviTag", "model_classtype": 2, "name": "temp_warning" }, { "default_value": "90", "id": 375, "model": "SENSOR_RuuviTag", "model_classtype": 2, "name": "temp_error" }, { "default_value": "0", "id": 376, "model": "SENSOR_RuuviTag", "model_classtype": 2, "name": "last_temp_error_time" }, { "default_value": "0", "id": 377, "model": "SENSOR_RuuviTag", "model_classtype": 2, "name": "last_notify_time" } ], "error": "None", "request_id": "019", "status": 0 }
- Statuscode 200
no error
- Statuscode 404
no models that match
-
api_get_propertymodels_by_object(object_id, request_id)¶ Returns all Property Models for an Object with ID
Example request:
GET /get_propertymodels_by_object/9/025 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": [ { "default_value": "12345", "description": "test_property_model_description", "id": 8, "name": "test_property_model", "object_class": 1, "object_model_id": 3, "pmode": 0, "value_column": 1 } ], "error": "None", "request_id": "025", "status": 0 }
- Statuscode 200
no error
- Statuscode 404
no models that match
-
api_get_propertymodels_by_objectmodel(model_id, request_id)¶ Returns all Property Models for an Object Model with ID
Example request:
GET /get_propertymodels_by_objectmodel/3/024 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": [ { "default_value": "12345", "description": "test_property_model_description", "id": 8, "name": "test_property_model", "object_class": 1, "object_model_id": 3, "pmode": 0, "value_column": 1 } ], "error": "None", "request_id": "024", "status": 0 }
- Statuscode 200
no error
- Statuscode 404
no models that match
-
api_get_relations_by_object(object_id, request_id)¶ Return all relations for a particular Object, grouped by relation type and related object ID
Example request:
GET /api/v1/get_relations_by_object_id/<OBJECT_ID>/<REQUEST_ID> HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": [ { "NEIGHBOR_OF": { "1843": { "object_details": { "disabled": false, "id": 1843, "ip": null, "mac": "FF:00:00:00:00:FF", "model_classname": "phenome.extensions.classtypes.ENVIRONMENT_SENSOR.base_sensor.BaseSensor", "model_classtype": 2, "model_id": 4, "model_name": "ROOT_SENSOR", "name": "FF:00:00:00:00:FF" }, "relation_details": { "depends": false, "details": "UNIT_TEST - test relation creation from API", "enabled": true, "id": 7, "object_id_from": 1842, "object_id_to": 1843, "relation_type": 13 } } } } ], "error": "None", "request_id": "051", "status": 0 }
- Statuscode 200
no error
- Statuscode 404
no objects/relations that match
-
api_get_required_properties_by_objectmodel(model_id, request_id)¶ Returns all REQUIRED Properties for an Object Model with ID
Example request:
GET /api_get_required_properties_by_objectmodel/3/026 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": [ { "id": 1, "name": "test_property_model", "value": 45678 }, { "id": 2, "name": "test_property_model", "value": 45678 }, { "id": 3, "name": "test_property_model", "value": 45678 } ], "error": "None", "request_id": "026", "status": 0 }
- Statuscode 200
no error
- Statuscode 404
no properties that match
-
api_get_total_object_count(request_id)¶ Returns the total Object Count tracked by this Phenome Agent
Example request:
GET /api/v1/get_total_object_count/031 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": { "value": 3 }, "error": "None", "request_id": "031", "status": 0 }
-
api_get_uimodel_by_id(model_id, request_id)¶ Return UI Model by ID
Example request:
GET /api/v1/get_uimodel_by_id/generic_button/063 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": [ { "id": "generic_button", "title": "", "type": "button" } ], "error": "None", "request_id": "063", "status": 0 }
- Statuscode 200
no error
- Statuscode 404
no models that match
-
get_predictions_by_classtype(model_classtype, request_id)¶ Return Predictions by ClassType
Example request:
GET /api/v1/get_predictions_by_classtype/ENVIRONMENT_SENSOR/003 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": [ { "metric_id": "metric1", "object_id": 1, "time_period": 1, "timestamp": 1579769580000, "value_predicted": 55.0 }, { "metric_id": "metric1", "object_id": 2, "time_period": 1, "timestamp": 1579769580000, "value_predicted": 65.0 }, { "metric_id": "metric1", "object_id": 3, "time_period": 1, "timestamp": 1579769580000, "value_predicted": 75.0 } ], "error": "None", "request_id": "003", "status": 0 }
- Statuscode 200
no error
- Statuscode 404
no models that match
-
get_predictions_by_object_and_metric_ids(object_id, metric_id, request_id)¶ Return Predictions by Object ID and Metric ID
Example request:
GET /api/v1/get_predictions_by_object_and_metric_ids/9/temperature/075 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": [ { "object_id": 9, "value": 54.0, "value_predicted": 55.0, "metric_id": "temperature", "time_period": 1, "timestamp": 1576178400000 }, { "object_id": 9, "value": 53.0, "value_predicted": 52.0, "metric_id": "temperature", "time_period": 1, "timestamp": 1576178460000 } ], "error": "None", "request_id": "075", "status": 0 }
- Statuscode 200
no error
- Statuscode 404
no object_ids that match
-
get_predictions_by_object_id(object_id, include_current, request_id)¶ Return Predictions by Object ID
Example request:
GET /api/v1/get_predictions_by_object_id/7/0/74 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": [ { "metric_id": "metric1", "object_id": 9, "time_period": 1, "timestamp": 1579769400000, "value_predicted": 55.0 }, { "metric_id": "metric2", "object_id": 9, "time_period": 1, "timestamp": 1579769400000, "value_predicted": 10.0 } ], "error": "None", "request_id": "074", "status": 0 }
- Statuscode 200
no error
- Statuscode 404
no object_ids that match
-
get_predictivemodel_stats_by_classtype_and_model(model_classtype, model_id, request_id)¶ Return Predictive Model Statistics by ClassType and Model ID
Will return the current Model accuracy and RSME values, the last time the Model was updated, and the model state. MODEL_STATE values include: INITIALIZED, WAITING, TRAINING, TESTING, and OPTIMIZED.
Example request:
GET /api/v1/get_predictivemodel_stats_by_classtype_and_model/ENVIRONMENT_SENSOR/health/05 HTTP/1.1 Host: http://localhost:5000 Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "api_version": 1, "core_version": "1.0.1", "data": [ { "health": { "ONE_MINUTE": { "accuracy": 93.439529181029684, "last_error": "", "last_update_time": 1570743242684, "rmse": 1.30753326416015625, "state": "TESTING" } } } ], "error": "None", "request_id": "070", "status": 0 }
- Statuscode 200
no error
- Statuscode 404
no models that match