Skip to content

API DOCS

tontech edited this page Jun 12, 2021 · 4 revisions

Welcome to the incubator-api wiki!

CREATE MACHINE SETTINGS

POST https://incubator-server.us-south.cf.appdomain.cloud/settings

Headers Content-Type: application/json

Body

{
   machine_id: String,
   humidity_min: Float,
   humidity_max: Float,
   temperature_min: Float,
   temperature_max: Float,
   incubation_days: Int,
   tilting_interval: Float(in hours),
   heater: Boolean(Default=False),
   heater_fan_motor: Boolean(Default=False),
   humidifier: Boolean(Default=False),
   humidifier_fan_motor: Boolean(Default=False)
}

UPDATE MACHINE SETTINGS

PUT https://incubator-server.us-south.cf.appdomain.cloud/settings

Headers Content-Type: application/json

Body

{
   machine_id: String,
   ***and/or***
   humidity_min: Float,
   humidity_max: Float,
   temperature_min: Float,
   temperature_max: Float,
   incubation_days: Int,
   tilting_interval: Float(in hours),
   heater: Boolean(Default=False),
   heater_fan_motor: Boolean(Default=False),
   humidifier: Boolean(Default=False),
   humidifier_fan_motor: Boolean(Default=False)
}

GET MACHINE SETTINGS

GET https://incubator-server.us-south.cf.appdomain.cloud/settings

Headers Content-Type: application/json

Query Params

{
   machine_id: String
}

SET INCUBATION

POST https://incubator-server.us-south.cf.appdomain.cloud/incubation

Headers Content-Type: application/json

Body

{
   machine_id: String,
   start_date: String(format="YYYY-MM-DD HH:MM:SS")
}

GET INCUBATION

GET https://incubator-server.us-south.cf.appdomain.cloud/incubation

Headers Content-Type: application/json

Query Params

{
   machine_id: String
}

GET NOTIFICATIONS

GET https://incubator-server.us-south.cf.appdomain.cloud/notifs

Headers Content-Type: application/json

Query Params

{
}

Sample Response

{
    "message": "Success",
    "notifs": [
        {
            "_id": "9cc4ce49b2ec6a881ad554dc768b4378",
            "_rev": "2-fdb4c8aa1fa4ab158b42638e6f942c6a",
            "humidity": "H:71.0%",
            "machine_id": "machine101",
            "message": "Maximum temperature reached.",
            "notif_type": "max_temp_reached",
            "temperature": "T:41.9C  ",
            "timestamp": "2021-06-07 14:27:18",
            "title": "Scan Update",
            "type": "notification"
        },
        {
            "_id": "d53b47bf108ff2648926d80548b608ac",
            "_rev": "1-440bf3d80c0838447c8e60bb4524e460",
            "humidity": "H:91.0%",
            "machine_id": "machine101",
            "message": "Maximum humidity reached.",
            "notif_type": "max_humid_reached",
            "temperature": "T:35.9C  ",
            "timestamp": "2021-06-07 13:27:18",
            "title": "Scan Update",
            "type": "notification"
        }
    ],
    "status": "ok"
}

GET REACHES (reach mix/max temp&&humid)

GET https://incubator-server.us-south.cf.appdomain.cloud/reaches

Headers Content-Type: application/json

Query Params

{
}

Sample Response

{
    "message": "Success",
    "reaches": [
        {
            "_id": "9cc4ce49b2ec6a881ad554dc768b4378",
            "_rev": "2-fdb4c8aa1fa4ab158b42638e6f942c6a",
            "humidity": "H:71.0%",
            "machine_id": "machine101",
            "message": "Maximum temperature reached.",
            "notif_type": "max_temp_reached",
            "temperature": "T:41.9C  ",
            "timestamp": "2021-06-07 14:27:18",
            "title": "Scan Update",
            "type": "notification"
        },
        {
            "_id": "d53b47bf108ff2648926d80548b608ac",
            "_rev": "1-440bf3d80c0838447c8e60bb4524e460",
            "humidity": "H:91.0%",
            "machine_id": "machine101",
            "message": "Maximum humidity reached.",
            "notif_type": "max_humid_reached",
            "temperature": "T:35.9C  ",
            "timestamp": "2021-06-07 13:27:18",
            "title": "Scan Update",
            "type": "notification"
        }
    ],
    "status": "ok"
}

GET LATES SCAN

GET https://incubator-server.us-south.cf.appdomain.cloud/latest/scan

Headers Content-Type: application/json

Query Params

{
}

Sample Response

{
    "message": "Success",
    "scan": {
        "_id": "9cc4ce49b2ec6a881ad554dc768b4378",
        "_rev": "2-fdb4c8aa1fa4ab158b42638e6f942c6a",
        "humidity": "H:71.0%",
        "machine_id": "machine101",
        "temperature": "T:41.9C  ",
        "timestamp": "2021-06-07 14:27:18"
    },
    "status": "ok"
}