I am a bit confused on the subject of an API and I would like to know if the concept is what I think.
Step 1: User uses the client part for the search
Step 2: The information is received to a function that makes a request to the server.
Step 3: The server sends you the found data.
Step 4: The function returns to the client what was successfully or unsuccessfully found.
That is, step 2 where I have the SQL queries in this case (that is, the communication with the server), would it be an api?
API: Application Programming Interface.
User(Front End) <---------> API <---------> Server(Back End) <---> Database
Step 1
User makes a request (http request) to the API
Step 2
The API takes your request and takes it to your Server
Step 3
Your server communicates with your Database, finds the order, prepares it and passes it back to the API
Step 4
API brings the ready order to the User.
One way that is used to explain is that of the restaurant. Trust in this video
Customer <---------> Waiter <---------> Kitchen <---> Meals
Step 1
Customer looks at the menu and places an order to the Waiter
Step 2
The waiter takes the order and takes it to the kitchen
Step 3
Kitchen receives the order, prepares the dish and gives it to the waiter
Step 4
The waiter brings the plate to the customer.
More than steps, an api can be seen as a library or library of methods that are usually made to be used or invoked in different areas, for example: Twitter has its own api, so if you want to create an application that needs to perform actions related to Twitter, you will use its library which already brings all the necessary methods to be able to use its functionalities. The same abstraction can be used for practically everything, programming languages are usually based on libraries, where you have one for each thing, for example there will always be a library for SQL, another for date treatment, another to expose services. Etc.