API Documentation
The API provides data for agricultural and aquacultural sensors. It supports both GET
and POST
methods to fetch data within a specific date range for a given node ID and application type.
Headers
- appName (required): Specify
aqua
oragri
. - nodeId (required): Unique identifier for the node.
- startDate (optional): Start date in
dd-MM-yyyy
format. Default:01-01-2022
. - endDate (optional): End date in
dd-MM-yyyy
format. Default:31-12-2030
. - apiKey (required): Authentication key for API access.
Responses
- 200 OK: Returns sensor data for the specified parameters.
- 400 Bad Request: Invalid date format.
- 403 Forbidden: Authentication failure or invalid parameters.
- 404 Not Found: No data available for the given criteria.
- 500 Internal Server Error: Server-side error.
Sample Request
GET /home/ApiServlet HTTP/1.1
Host: smartkheti.co.in
appName: agri/aqua
startDate: 01-01-2024
endDate: 24-10-2025
apiKey: AGRIAQUATESTAPI
nodeId: SP10AGRI/SP10AQUA
Note: Use the appropriate appName
for your request. It may be agri
or aqua
. The nodeId
should correspond to the specific application. For example, SP10AGRI
is used for the agri application, and SP10AQUA
is used for the aqua application.
Sample Response for AgriCulture
{
"data": {
"2024-11-29 22:26:25": {
"device_name": "dev201",
"a_temp": 24.0,
"batt_Level": "100",
"a_humi": 51.0,
"s_humi": 10.0,
"s_temp": 24.0,
"cr": "SP10AGRI"
},
"2024-11-29 22:56:09": {
"device_name": "dev201",
"a_temp": 24.0,
"batt_Level": "55",
"a_humi": 51.0,
"s_humi": 10.0,
"s_temp": 24.0,
"cr": "SP10AGRI"
},.......
},
"info": {
"Api_Expiring": "2026-01-10 17:11:05.0",
"requests": "89/1000"
}
}
Sample Response for AquaCulture
{
"data": {
"2025-01-01 15:14:32": {
"w_oxy": 22.37,
"device_name": "dev201",
"a_temp": 29.0,
"a_humi": 81.4,
"w_temp": 29.6,
"cr": "SP10AQUA"
},
"2025-01-01 15:13:49": {
"w_oxy": 21.42,
"device_name": "dev201",
"a_temp": 29.0,
"a_humi": 81.4,
"w_temp": 29.6,
"cr": "SP10AQUA"
},....
},
"info": {
"Api_Expiring": "2026-01-10 17:11:05.0",
"requests": "90/1000"
}
}
ERROR Responses
{
"message": "API key has expired"
}
The API key you are using has expired. Please obtain a new API key from the service provider to continue making requests.
{
"message": "Invalid API key"
}
The API key entered is invalid. Ensure that the API key you provided is correct and has the necessary permissions to access the service.
{
"message": "max request limit reached"
}
You have reached the maximum number of allowed requests for your API key. Please check your request limit and wait until the limit resets, or consider upgrading your plan to increase the limit.
{
"message": "invalid appName"
}
The application name you have provided is incorrect or not recognized. Verify that the application name is correct and matches the one you are authorized to use.
{
"message": "Invalid date format"
}
The date format entered is invalid. Ensure that the date follows the correct format required by the API (e.g., YYYY-MM-DD). Refer to the API documentation for the expected date format.
{
"message": "Please try again after 1 minute of last access at 2025-01-30 06-04-00"
}
Your request rate is too high. Please wait for 1 minute before trying again to avoid exceeding rate limits. Try to space out your requests to avoid service disruption.