TriggerIO - API Documentation

Generated automatically - Author: Nico-Curti

Server Status

Endpoint: GET /

Home page API to check the server status. This route is used to verify that the web server is running correctly by responding with a simple message.

Parameters

Request Generator

$ curl -X GET https://trigger-io.difa.unibo.it/dev/api/

Response

{ "message": "No request made yet." }

Authentication

Endpoint: POST /auth

Handles authentication via POST request. This endpoint receives an email and password from the client and checks their validity against the accounts table in the database. If the credentials are correct, the server generates a unique authentication token, stores it in the accounts table, and updates the last login timestamp.

Parameters

  • email (string) - The email of the user attempting to log in.
  • password (string) - The password of the user.

Request Generator

$ curl -X POST https://trigger-io.difa.unibo.it/dev/api/auth

Response

{ "message": "No request made yet." }

LogOut

Endpoint: POST /logout

Handles user logout via POST request. This endpoint logs out a user by invalidating their authentication token. Given a valid token, the corresponding entry in the accounts table is replaced or removed to ensure security. This API enhances the security of user communications by allowing explicit session termination.

Parameters

  • token (string) - The authentication token to be invalidated.

Request Generator

$ curl -X POST https://trigger-io.difa.unibo.it/dev/api/logout

Response

{ "message": "No request made yet." }

Generate credentials

Endpoint: POST /credentials

Handles the creation of a new account in the dedicated table. This endpoint allows the creation of a new account identified by email and password, returning the "unique" string as output for the transfer of the information to humans. The response is the "unique" string for the patient authentication.

Parameters

  • email (string) - The email of the user attempting to log in.
  • password (string) - The password of the user.

Request Generator

$ curl -X POST https://trigger-io.difa.unibo.it/dev/api/credentials

Response

{ "message": "No request made yet." }

Insert Issue

Endpoint: POST /private/issues

Handles insertion of new issue in the dedicated table. This endpoint allows inserting new issue records in the dedicated table, specifying the details about it in the route parameter. The endpoint does not require authentication since it must be available to all the users of the service. The response is just a status code about the success or not of the insertion.

Parameters

  • type (string) - The type of issue to open.
  • nationality (string) - The nationality of the partner who opened it.
  • details (string) - The decription of the issue.
  • comments (string) - The comments about the issue.

Request Generator

$ curl -X POST https://trigger-io.difa.unibo.it/dev/api/private/issues

Response

{ "message": "No request made yet." }

Get opened issues

Endpoint: GET /private/issues-close

Handles the redirect to the HTML page for issue closing. This endpoint allows to redirect to the correspoding HTML page for the closing procedure of an opened issue. The endpoint does not require authentication since it must be available to all the users of the service. The response is just a status code about the success or not of the insertion.

Parameters

  • issue_id (string) - The id of the desired issue.
  • issue_type (string) - The type of the desired issue.

Request Generator

$ curl -X GET https://trigger-io.difa.unibo.it/dev/api/private/issues-close

Response

{ "message": "No request made yet." }

Close opened issues

Endpoint: POST /private/issues-close

Handles the closing of an opened issue in the dedicated table. This endpoint allows to close an existing issue record in the dedicated table, specifying the details about it in the body parameter. The endpoint does not require authentication since it must be available to all the users of the service. The response is just a status code about the success or not of the insertion.

Parameters

  • issue_id (string) - The id of the issue.
  • issue_type (string) - The type of the issue.

Request Generator

$ curl -X POST https://trigger-io.difa.unibo.it/dev/api/private/issues-close

Response

{ "message": "No request made yet." }

Insert data

Endpoint: POST /:table

Handles insertion of data into a specified table via POST request. This endpoint allows inserting data into a dynamic table, specified in the route parameter. The authentication token provided in the request body is used to retrieve the corresponding user ID from the accounts table, ensuring only authenticated users can perform the insertion. This operation updates the user_{table} association table between users and devices.

Parameters

  • token (string) - The authentication token used to retrieve the user ID.
  • data (json) - The data to be inserted into the specified table.
  • table (string) - The name of the table where data will be inserted.

Request Generator

$ curl -X POST https://trigger-io.difa.unibo.it/dev/api/:table

Response

{ "message": "No request made yet." }

Extract data

Endpoint: GET /:table

Handles retrieval of data from a specified table via GET request. This endpoint allows generic querying of any whitelisted table using flexible query parameters. It supports filtering (including comparison operators), searching, grouping, ordering, limiting and pagination. The authentication token provided in the request headers is used to validate access. The response data is filtered according to the query parameters provided in the request. Allowed query parameters:

  • * `select`: comma-separated list of columns to return (optional)
  • * `where`: comma-separated conditions with operators (=, >, <, >=, <=), e.g. `year>2025,month<=10`
  • * `like`: comma-separated key:value pairs for partial matches, e.g. `userId:1`
  • * `groupBy`: column name to group by
  • * `orderBy`: column name to order results
  • * `order`: `ASC` or `DESC` (default: ASC)
  • * `limit`: max number of results
  • * `offset`: number of records to skip (for pagination)
Whitelisted tables and columns are enforced to prevent SQL injection.

Parameters

  • token (string) - The authentication token used to validate access.
  • params (Object) - The parameters to use in the query.
  • table (string) - The name of the table from which data will be retrieved.

Request Generator

$ curl -X GET https://trigger-io.difa.unibo.it/dev/api/:table

Response

{ "message": "No request made yet." }