## 2 RestRho: Building REST APIs Based on JSON-DSL
### RestRho for the Specification, Implementation, and Deployment of RESTful APIs
#### 2.3.2 SQLRho Language  
In the Algorithm 2, a summary explanation of an SQLRho program is shown. It has eight defined attributes: Name (where <db> is part of the Path, which is defined in (1) for the HTTP request), Description (where <description> is a brief description of the program), Connector (the connector type database, <conector>=[mariadb|mysql]), EnableToken (enables the use of the token for any HTTP request, <enable>=[true|false]), Pool (defines the standard connection pool to a MariaDB ( [[https://mariadb.com/docs/connectors/mariadb-connector-nodejs/getting-started-with-the-node-js-connector](https://mariadb.com/docs/connectors/mariadb-connector-nodejs/getting-started-with-the-node-js-connector)]([https://mariadb.com/docs/connectors/mariadb-connector-nodejs/getting-started-with-the-node-js-connector](https://mariadb.com/docs/connectors/mariadb-connector-nodejs/getting-started-with-the-node-js-connector)) (accessed on 10 June 2025)) database or MySQL ( [[https://www.npmjs.com/package/mysql/](https://www.npmjs.com/package/mysql/)]([https://www.npmjs.com/package/mysql/](https://www.npmjs.com/package/mysql/)) (accessed on 10 June 2025)), Registry, Templates, and Tables. ```
{  \"Name\": \"<do>\",  \"Description\": \"<description>\",  \"Connector\": \"<connector\", //<connector>: mariadb|mysql  \"EnableToken\": <enable>, //<enable>: false|true  \"Pool\": [\"host\":\"- \"user\":\"- \"password\":\"- \"database\":\"- \", \"connectionLimit\":<int> },  \"Registry\": {\"Table\":\"- \"User\":\"- \"Password\":\"- \", \"ValidityMinutes\": <int> },  \"Templates\": {..., \"<nameTemplate>\": {\"Dir\":\"<dirI\", \"File\":\"<nameFileI\"},... },  \"Tables\": { ...,  \"<tableI\": {  \"Encrypt\": [\"<field1>\",..., \"<fieldK\",...],  \"Decrypt\": [\"<field1>\",..., \"<fieldJ\",...],  \"Uses\": [\"use1\",..., \"useI\",..., \"useN\"],  \"Operations\": { ...  \"<operationI\">\": {  \"Name\": \"<nameOperation>\",  \"Action\": \"<action>\",  \"Parameters\": {\"query\": [\"<param1>\",..., \"<paramJ\"] },  \"Clauses\": {\"Fields\": \"-\", \"Where\": \"-\", \"OrderBy\": \"-\",... },  \"Transform\": {\"Type\": \"<type\",..., \"<varI\":... },  \"Template\": \"<nameTemplate>\"  }  }  } ...  }  }  } ...  } }
```  
**Algorithm 2** RhoCode SQLRho  
The attribute Registry is an object defining the database record table. The attribute Table is the name of the user table, the attribute User is the name of the user's field, the attribute Password is the name of the field password, and the attribute ValidityMinutes is the time in seconds of the validity of the generated token. When EnableToken is enabled, the operation of the login to obtain the token has the following structure:  
```
<protocol>://<host>/<db>/login?User=<user>&Password=<password>
```  
where <protocol> (http|https) is the configured protocol, <host> is the host and port of the service, login is the resource, <user> and <password> are the input parameters. This token must be sent in the protocol header in all the operations to be performed. The attribute Templates is an object defining the set of Handlebars templates to be used for transformations of the results of table operations, where <nameTemplate> is the template name, <dirI> is the directory, and <nameFile> is the filename of Handlebars. Finally, the attribute Tables is the set of Tables to which HTTP requests shall target. For each <tableI> (database table name), four attributes are set:1. **Encrypt**: is the list of field names <FieldK>, of the table <table> to be encrypted for sending. For data encryption, RestRho uses an AES-256 algorithm in CBC (Cipher Block Chaining) mode. Sensitive fields are usually encrypted to protect confidential information (table identifiers, passwords, personal data, medical history, bank details, etc). 2. **Decrypt**: is the list of field names <Field> of the table <table> to be decrypted on the server for processing. Similarly, RestRho uses the same AES-256 algorithm in CBC mode to decrypt the data. 3. **Uses**: element defines the set of fundamental operations available for <table>.