Intervals API Documentation¶
Overview¶
The Intervals API facilitates the management of time intervals for various processes. It provides endpoints to create, retrieve, update, and delete interval settings stored in a database. These intervals are used to configure timing for various operations in applications.
Note: All endpoints require the header:
x-api-key: YOUR_API_KEY_HERE
This documentation includes:
- Endpoints – Purpose, request structure, and sample responses.
- Additional Notes – Shared logic or constraints applied across endpoints.
Endpoints¶
Create Intervals Table¶
POST /intervals/createTable¶
- Summary: Creates the
intervalstable if it does not already exist. -
Description:
Initializes the database table for storing interval configurations. -
Response:
- 200 OK: Table created successfully.
- 400 Bad Request: Error creating the table.
Get All Intervals¶
GET /intervals¶
- Summary: Retrieves all stored intervals.
-
Description:
Returns a list of all interval configurations stored in the database. -
Response Example:
[ { "id": 1, "intervalFeedbackTestApi": 5000, "intervalDeviceStatus": 10000, "intervalDeviceStatusEspera": 15000, "intervalAllDevices": 20000 } ]
Get Interval by ID¶
GET /intervals/:id¶
- Summary: Retrieves a specific interval by its ID.
-
Description:
Fetches the interval configuration corresponding to the provided ID. -
Response Example:
{ "id": 1, "intervalFeedbackTestApi": 5000, "intervalDeviceStatus": 10000, "intervalDeviceStatusEspera": 15000, "intervalAllDevices": 20000 }
Create Interval¶
POST /intervals¶
- Summary: Creates a new interval.
-
Description:
Adds a new interval configuration to the database. -
Request Body Example:
{ "intervalFeedbackTestApi": 5000, "intervalDeviceStatus": 10000, "intervalDeviceStatusEspera": 15000, "intervalAllDevices": 20000 } -
Response:
- 200 OK: Interval created successfully.
- 422 Unprocessable Entity: Invalid interval data.
- 500 Internal Server Error: Database insertion error.
Update Interval by ID¶
PUT /intervals/:id¶
- Summary: Updates a specific interval by its ID.
-
Description:
Modifies the interval configuration corresponding to the provided ID. -
Request Body Example:
{ "intervalFeedbackTestApi": 6000 } -
Response:
- 200 OK: Interval updated successfully.
- 422 Unprocessable Entity: Invalid update information.
- 500 Internal Server Error: Database update error.
Delete Interval by ID¶
DELETE /intervals/:id¶
- Summary: Deletes a specific interval by its ID.
-
Description:
Removes the interval configuration corresponding to the provided ID from the database. -
Response:
- 200 OK: Interval deleted successfully.
- 422 Unprocessable Entity: Invalid ID format.
- 500 Internal Server Error: Database deletion error.
Additional Notes¶
The following constraints are applied across interval endpoints:
- All interval objects must include the following required fields:
intervalFeedbackTestApiintervalDeviceStatusintervalDeviceStatusEsperaintervalAllDevicesintervalDeviceWatchersintervalDeviceWatchersTimeoutintervalRefreshTokenintervalDeviceInternalConsult-
intervalDeviceSyncInfo -
If any required fields are missing or have an invalid format, the API will return a 422 Unprocessable Entity response.