EMC: API

Created by Eddie Merrifield, Modified on Mon, 20 May, 2024 at 11:11 AM by Eddie Merrifield

The EMC API is a way for customers to pull data collected by EMC into their own systems.

To make calls against the API, you need to key values to pass along to the API. They are the AreaId and ApiKey. Both values are GUIDs and can be obtained by visiting this page within EMC: https://emc.loftuslabs.com/Support/AccessAPI


The API is documented by a Swagger page that allows you to test the output of each call.  The swagger page is located at:  https://emcapi.loftuslabs.com/index.html


Each API currently contains 4 executable methods.  Each method can be accessed by both a POST or a GET. The methods are:


  • getenvironment

    • Inputs:  None
    • Returns:  value of “Production” or “Development” depending on which database the API is pointed at.  Used for configuration validation.
  • getstationlist - API wrapper for the stored procedure usp_s_StationListForCustomerAPI

    • Inputs:
      • ApiKey (Guid) as a request header
      • AreaId (Guid) as a URL parameter
    • Returns:  JSON formatted list of stations in the AreaId provided, utilizing the StationList data model.
    • Example JSON:
[
    {
        "stationName": "Station2"
    }
 ]
  • getsensorlist - API wrapper for the stored procedure usp_s_SensorListByStationNameForCustomerAPI

    • Inputs:
      • ApiKey (Guid) as a request header
      • AreaId (Guid) as a URL parameter
      • StationName (string) as a URL parameter
    • Returns:  JSON formatted list of sensors on the station in the AreaId provided, utilizing the SensorForApi data model.
    • Example JSON:
[
   {
        "sensorName": "Flow Meter 1",
        "sensorDescription": "Flow Meter 1",
        "sensorClassificationType": "FLWR",
        "sensorUom": "gpm",
        "latitude": 44.5235690,
        "longitude": -121.4352970,
        "sensorDepth": 0,
        "isActive": true
    }
 ]


  • getmeasurements - API wrapper for the Stored Procedure usp_s_MeasurementsForAPI

    • Inputs:
      • ApiKey (Guid) as a request header
      • AreaId (Guid) as a URL parameter
      • StationName (string) as a URL parameter
      • MaxRecords (int) as a URL parameter.  If a value over 10000 is passed, the request will automatically reduce it to 10000
      • LastModifiedOn (DataTime) as a URL parameter.  This value should come in the format YYYY-MM-DDThh:mm:ss, example 2024-01-12T00:00:00 would be midnight on January 12, 2024.
    • Returns: JSON formatted list of measurements for the AreaId and StationName provided in the Measurement Data Model. Will return MaxRecords or 10000 records, whichever is smaller starting with the LastModifiedOn date.  It is important to distinguish that the LastModifiedOn date is the datetime that the record arrived in the database, not the datetime of the actual measurement. This will allow retrieval of records that come in well after their actual measurement time due to delay of data collection.
    • Example JSON:
[
     {
        "measurementId": 3854425619,
        "areaName": "North 40",
        "blockName": "Block 1",
        "rowName": null,
        "stationName": "Station2",
        "sensorName": "Battery Voltage",
        "sensorId": 2004,
        "sensorClassificationType": "VOLT",
        "intervalName": "Daily",
        "uomName": "V",
        "value": 12.6,
        "createdOnLocal": "2022-10-13T00:00:00",
        "lastModifiedOn": "0001-01-01T00:00:00"
    }
 ]






































Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article