EchoPortal REST APIs

The EchoPortal Cloud Infrastructure APIs are typical REST APIs that use HTTPS requests and responses. This web page describes basic information about using the APIs.

API Reference

For links to the EchoPortal Infrastructure API reference and a list of the API endpoints, see

API Configuration

For links to the EchoPortal API settings, see

Request and Response Format

The EchoPortal Infrastructure APIs use standard HTTP requests and responses. Each may contain EchoSensor specific headers for pagination, entity and so on as described elsewhere in this topic and in the API documentation.
Each response includes a unique Echosensor-assigned request API-ID (for example, ff3f3275-f356-462a-7321-caf0b312fe02) in the response data.
Many of the API operations require JSON in the request body or return JSON in the response body. The specific contents of the JSON are described in the API documentation for the individual operation.

Request Signing Required

All EchoPortal Infrastructure API requests must be signed for authentication purposes. For information about the required credentials and how to sign the requests, see Request Signatures.

HTTPS and TLS 1.2 Required

All EchoPortal Cloud Infrastructure API requests must support HTTPS and SSL protocol TLS 1.2

Request Throttling

EchoPortal Infrastructure applies throttling to many API requests to prevent accidental or abusive use of resources. If you make too many requests too quickly, you might see some succeed and others fail. EchoSensor recommends that you implement an exponential back-off, starting from a few seconds to a maximum of 60 seconds. When a request fails due to throttling, the system returns response code error.

API call limit

To prevent abuse of the EchoPortal API, you can send a call every 30 seconds

Use CURL to read latest sensor data from EchoPortal:

curl -A "echoSensor" -F "json=true" -F "sn=yourDeviceNumber" -F "apikey=ff3f3275-f356-462a-7321-caf0b312fe02" -F "user=yourUsername" -F "pass=yourPassword" https://echosensor-server/api/
				

JSON output:

{
	"type":"LIGHT",
	"serial":"Z17795135172",
	"value":"964",
	"cpuTemperature":"16.67",
	"latestTime":"13:47:33",
	"latestDate":"2022/11/19"
}
				
you can set the parameter json=false to receive data in csv format:
964,53.33,14:10:59,2022/11/19,LIGHT

Error Code:


{
	"Code":"Session",
	"Type":"Auth.Error.x"
}

Use PHP and receive csv data


// set json true or false
$pars=array(
'json' => 'false',
'sn' => 'DEVICE_NUMBER',
'apikey' => 'ff3f3275-f356-462a-7321-caf0b312fe02',
'user' => 'YourUsername',
'pass' => 'YourPassword',
);
//step1
$curlSES=curl_init();
//step2
curl_setopt($curlSES,CURLOPT_URL,"https://sgneep.com/portaldata_api/");
curl_setopt($curlSES,CURLOPT_USERAGENT,"echosensorHeader");
curl_setopt($curlSES,CURLOPT_RETURNTRANSFER,true);
curl_setopt($curlSES,CURLOPT_HEADER, false);
curl_setopt($curlSES, CURLOPT_POST, true);
curl_setopt($curlSES, CURLOPT_POSTFIELDS,$pars);
curl_setopt($curlSES, CURLOPT_CONNECTTIMEOUT,10);
curl_setopt($curlSES, CURLOPT_TIMEOUT,30);
//step3
$result=curl_exec($curlSES);
//step4
curl_close($curlSES);
//step5
echo $result;

Use with python:


import requests
#pip install requests

url = "https://echosensor-server/api/"
data = "sn=DEVICE_NUMBER&json=true&apikey=ff3f3275-f356-462a-7321-caf0b312fe02&user=YourUsername&pass=YourPassword"
headers = {'User-Agent': 'echosensor','Content-Type': 'application/x-www-form-urlencoded'}

r = requests.post(url, data=data, headers=headers)
print(r.text)