**EMS Plant** =============== **Fetch Energy Metrics for Plant** +++++++++++++++++++++++++++++++++++++++++ .. http:get:: /_ems/plant/ **Description** Fetch details of Energy Metrics of a specific Plant by its ID. **HTTP Method** GET **ENDPOINT** ``/_ems/plant/`` **Request Header** ``Authorization`` `Basic ` **Request Parameters** URL Parameters - ``plant_id`` (string, *required*): The ID of the plant to retrieve details for. Query Parameters - ``from`` (date range, *required*): The date range from when to retrieve details for the plant. - ``to`` (date range, *required*): The date range till when to retrieve details for the plant. **Sample Request** .. code-block:: sh curl -X GET 'https://app.4pointx.com/_ems/plant/e29ae75e-dd88-45ef-90cb-cefb3807af70?from=2023-10-24T10:32:24.527Z&to=2023-10-30T10:32:24.527Z' \ --header 'Authorization: Basic ' \ **Sample Response** Success .. sourcecode:: json { "site_id": "d2e66edd-f13f-4d00-a7b5-8cab9ef4488d", "site_name": "Demo Site", "plant_id": "54c95758-a66d-45fd-8118-2ce361b505f5", "plant_name": "test-plant-demo13", "total_consumption": 0.0, "total_energy": 0.0, "energy_unit": "MWh", "total_production": 0.0, "production_unit": "ton", "idle_energy": 0.0, "idle_energy_percent": 0, "kwh_per_unit": 0 } Error .. sourcecode:: json { "error": { "status": 401, "message": "Unauthorized access to module by general-user" } } .. sourcecode:: json { "error": { "status": 400, "message": "Plant id not given." } } .. sourcecode:: json { "error": { "status": 400, "message": "Plant details not found." } } .. sourcecode:: json { "error": { "status": 400, "message": "Site details not found." } } **Fetch Energy Metric trend for Plant** +++++++++++++++++++++++++++++++++++++++++++++ .. http:get:: /_ems/plant/_trend/ **Description** Fetch details of Energy Metrics of a specific plant by its ID. **HTTP Method** GET **ENDPOINT** ``/_ems/plant/_trend/`` **Request Header** ``Authorization`` `Basic ` **Request Parameters** URL Parameters - ``plant_id`` (string, *required*): The ID of the plant to retrieve trend for. Query Parameters - ``metric`` (string, *required*): The type of trend selected from predefined options such as (consumption_chart, prod_vs_kwh_per_ton, or idle_energy_vs_kwh_all) each triggering a distinct process.. - ``interval`` (time range, *required*): Hourly, Daily, Weekly or Monthly trend to be collected. - ``from`` (date range, *required*): The date range from when to retrieve details for the plant. - ``to`` (date range, *required*): The date range till when to retrieve details for the plant. **Sample Request** .. code-block:: sh curl -X GET 'https://app.4pointx.com/_ems/plant/_trend/e6f198d8-bb55-46ea-bf01-424f512553d4?from=2023-04-28T18:30:00.000Z&to=2023-05-29T18:29:59.999Z&metric=consumption_chart&interval=week' \ --header 'Authorization: Basic ' \ **Sample Response** Success .. sourcecode:: json [ { "Date": "2023-04-24T00:00:00.000Z", "Energy": 0.0, "unit": "MWh" }, { "Date": "2023-05-01T00:00:00.000Z", "Energy": 0.0, "unit": "MWh" }, { "Date": "2023-05-08T00:00:00.000Z", "Energy": 0.0, "unit": "MWh" }, { "Date": "2023-05-15T00:00:00.000Z", "Energy": 0.0, "unit": "MWh" }, { "Date": "2023-05-22T00:00:00.000Z", "Energy": 0.0, "unit": "MWh" }, { "Date": "2023-05-29T00:00:00.000Z", "Energy": 0.0, "unit": "MWh" }, { "Date": "2023-05-07T00:00:00.000Z", "Energy": 450.47, "unit": "MWh" }, { "Date": "2023-05-14T00:00:00.000Z", "Energy": 114.48, "unit": "MWh" }, { "Date": "2023-05-21T00:00:00.000Z", "Energy": 153.22, "unit": "MWh" }, { "Date": "2023-05-28T00:00:00.000Z", "Energy": 60.61, "unit": "MWh" }, { "Date": "2023-06-04T00:00:00.000Z", "Energy": 1.07, "unit": "MWh" } ] Error .. sourcecode:: json { "error": { "status": 401, "message": "Unauthorized access to module by general-user" } } .. sourcecode:: json { "error": { "status": 400, "message": "Plant ID not given." } } .. sourcecode:: json { "error": { "status": 400, "message": "Metric not given." } } .. sourcecode:: json { "error": { "status": 400, "message": "Idle energy data not available" } } .. sourcecode:: json { "error": { "status": 400, "message": "Energy or Production data not available" } }