What is SQL API?
Published in
2 min readFeb 15, 2022
In this article, you can find what SQL API developed by ÇiçekSepeti technology team is, which databases it supports, how it is used, and the example created in Postman.
What is SQL API?
- SQL API is HTTP request that allows us to send a query to the database. You can access the source code of the project here and get more information, SQL API.
- Warning! Do not use it in production. SQL API is suitable for test environments. In particular for
integration tests
.
Which problem is solved by SQL API?
- After sending successful HTTP requests, it checks the records contained in the database.
For example, It checks that the data sent to the database is saved in POST requests, and data is deleted from the database in DELETE requests.
Which databases does SQL API support?
- MySQL
- MsSQL
- MongoDB
How to use SQL API?
- After creating the database, SQL API request is created through the tool to be tested (Postman, RestAssured, Insomnia). HTTP request can be made by url http://localhost:8033/sql for local test runs. The body of this request should contain database and query information.
SQL API request body usage in different databases:
Example of SQL API created in Postman:
- In this example, the user is created with a POST request in Pre-request. However, the user information is not received in the request’s response. In the same test scenario, the user data created in the database is checked by sending a request to SQL API.
Useful links:
https://hub.docker.com/r/techciceksepeti/sqlapi
https://github.com/ciceksepetitech/sqlapi