Using the API
Guide on how to use the API via H2 Console and HTTP endpoints
How to Use the Local API
This section explains how to access and test the product management API using two approaches: directly through the H2 database or via HTTP requests.
Accessing the H2 database
The project uses an in-memory H2 Database, which allows you to view and manipulate data directly through the browser.
Steps to access:
-
Open your browser and go to:
http://localhost:8080/h2-console -
Configure the connection:
- JDBC URL:
jdbc:h2:mem:testdb - Username:
sa - Password: (leave empty)
-
Click on "Connect".
-
You can run SQL queries directly, for example:
INSERT INTO PRODUTO (PRECO, NOME) VALUES ('Teclado', 50)- Select data:
SLECT * FROM PRODUTO;- Query a specific product by ID:
SLECT * FROM PRODUTO id = 1;- Update data:
UPDATE PRODUTO SET PRECO = 4000.00 WHERE id = 1;- Delete data:
DELETE FROM PRODUTO WHERE id = 1;How to Use the Web API
Access the URL
The web API is hosted on Azure, and you can interact with it by making HTTP requests to the provided endpoints.