> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apinizer.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Creating API from Database with API Creator

> You can create REST APIs that perform database operations in minutes without requiring technical knowledge with DB-2-API. You can run SQL and NoSQL queries, call Stored Procedures, perform Batch operations, and perform CRUD operations

It supports the following operations:

<CardGroup cols={3}>
  <Card title="Native SQL Statements" icon="database">
    Supports SELECT, INSERT, UPDATE, DELETE, PROCEDURE, BATCH INSERT, TRUNCATE operations.
  </Card>

  <Card title="NoSQL Operations" icon="database">
    Provides FIND operation type support.
  </Card>

  <Card title="Stored Procedure" icon="code">
    Provides Stored Procedure calling support.
  </Card>

  <Card title="Cursor Support" icon="arrows-rotate">
    Can return cursor result.
  </Card>

  <Card title="Batch Operations" icon="list">
    Provides batch operation support.
  </Card>

  <Card title="CRUD Operations" icon="gear">
    Supports all CRUD operations.
  </Card>
</CardGroup>

## Creating New DB-2-API

<Steps>
  <Step title="Go to DB-2-API Page from Menu">
    **Development → API Creator → DB-2-API** item is selected in the main menu.
  </Step>

  <Step title="Create New API">
    The **+Create** button at the top right of the opened interface is clicked.

    <img src="https://mintcdn.com/apinizer/brWu4H3JyK0OgbJV/images/develop/api-proxy-olusturma/db-api-olustur-butonu.png?fit=max&auto=format&n=brWu4H3JyK0OgbJV&q=85&s=8682d79b5ba160c5ef3dceb6d68a34d9" alt="DB-2-API Create button" width="800" data-path="images/develop/api-proxy-olusturma/db-api-olustur-butonu.png" />
  </Step>

  <Step title="Fill API Information">
    Required fields for the new *API* to be created are filled and the **→Save and Next** button at the top right is clicked, starting the *API* creation process.

    <img src="https://mintcdn.com/apinizer/xcpaeYP822whFSPn/images/develop/api-proxy-olusturma/db2api-new.png?fit=max&auto=format&n=xcpaeYP822whFSPn&q=85&s=67e0b3d1d6a1ac1056279b62ed73c1cc" alt="Filling DB-2-API information" width="800" data-path="images/develop/api-proxy-olusturma/db2api-new.png" />
  </Step>
</Steps>

## Endpoint Creation

<Steps>
  <Step title="Add Endpoint">
    *Method/Endpoint* is added to the API by clicking the **Add** button on the screen that appears.

    <img src="https://mintcdn.com/apinizer/brWu4H3JyK0OgbJV/images/develop/api-proxy-olusturma/db-api-endpoint-ekle.png?fit=max&auto=format&n=brWu4H3JyK0OgbJV&q=85&s=58ba722c65a226a6333488b2f5037e19" alt="Add endpoint" width="800" data-path="images/develop/api-proxy-olusturma/db-api-endpoint-ekle.png" />
  </Step>

  <Step title="Fill Endpoint Information">
    Fields in the *Method/Endpoint* definition screen are filled and the **Save** button is clicked.

    <img src="https://mintcdn.com/apinizer/brWu4H3JyK0OgbJV/images/develop/api-proxy-olusturma/db-api-endpoint-tanimlama.png?fit=max&auto=format&n=brWu4H3JyK0OgbJV&q=85&s=eb7b17dc3fa177fb2dd0bfb550f8eb5e" alt="Endpoint definition" width="800" data-path="images/develop/api-proxy-olusturma/db-api-endpoint-tanimlama.png" />
  </Step>
</Steps>

Fields used to create endpoints are explained below, categorized:

<AccordionGroup>
  <Accordion title="Basic Information">
    <CardGroup cols={2}>
      <Card title="HTTP Method" icon="list">
        **Field:** HTTP Method

        HTTP Method is selected for REST APIs: GET, POST, PUT, HEAD, OPTIONS, DELETE, PATCH, TRACE, ALL
      </Card>

      <Card title="Name/URL" icon="tag">
        **Field:** Name/URL

        The name given to Method/Endpoint by the user. This name appears in interfaces.
      </Card>

      <Card title="Description" icon="file-lines">
        **Field:** Description

        Definition information of Method/Endpoint.
      </Card>
    </CardGroup>
  </Accordion>

  <Accordion title="Database Connection">
    <CardGroup cols={2}>
      <Card title="Connection Pool" icon="database">
        **Field:** Connection Pool Description

        Information about the Database connection where queries will be executed.
      </Card>

      <Card title="Query Timeout" icon="clock">
        **Field:** Timeout

        Timeout value in seconds for query execution.
      </Card>
    </CardGroup>
  </Accordion>

  <Accordion title="SQL Operations">
    <CardGroup cols={2}>
      <Card title="SQL Statement Type" icon="code">
        **Field:** Type of SQL Statement

        SQL Statement type information: SELECT, UPDATE, INSERT, DELETE, PROCEDURE, TRUNCATE, BATCH INSERT
      </Card>

      <Card title="SQL Statement" icon="code">
        **Field:** SQL

        The SQL statement to be executed. Parameters must be written with a colon (`:`) prefix without spaces to be definable.

        **Example query:**

        ```sql theme={null}
        select * from employees where first_name = :fName
        ```

        Here `:fName` is a parameter and is sent by the user making a request to the API.

        <Tip>
          You can check the correctness of your query by entering example values for the parameter and clicking the **Try It** button.
        </Tip>
      </Card>
    </CardGroup>
  </Accordion>

  <Accordion title="NoSQL Operations">
    <CardGroup cols={2}>
      <Card title="Operation Type" icon="database">
        **Field:** Operation Type

        NoSQL operation type information: FIND
      </Card>

      <Card title="Query" icon="code">
        **Field:** Query

        The query to be executed. Parameters are enclosed in double curly braces to be definable.

        **Example query:**

        ```javascript theme={null}
        { username: {{username}} }
        ```

        Here `{{username}}` is a parameter and is sent by the user making a request to the API.

        <Tip>
          You can check the correctness of your query by entering example values for the parameter and clicking the **Try It** button.
        </Tip>
      </Card>
    </CardGroup>
  </Accordion>

  <Accordion title="Parameters">
    <Card title="Parameters" icon="slider">
      **Field:** Parameters

      If there is a parameter like `:fName` in your SQL Query, the Parameters table opens. Here the parameter's:

      * Data Type
      * Format
      * Repetition Type
      * Parameter Type
      * Example Values

      are entered.

      <Info>
        Then by clicking the **Try** button, the "Response Message Example" comes according to this data.
      </Info>
    </Card>
  </Accordion>
</AccordionGroup>

## Testing SQL

It may be desired to see what result will be obtained when a request is sent to the endpoint. If the query to be executed for the endpoint has parameters, test data (Test Value) is entered and the **Try It** button is pressed.

The template returned as the test result is the Response object that is stable in Apinizer. If there are multiple records matching the query, only the first record is given in the example response.

<img src="https://mintcdn.com/apinizer/brWu4H3JyK0OgbJV/images/develop/api-proxy-olusturma/db-api-sql-test.png?fit=max&auto=format&n=brWu4H3JyK0OgbJV&q=85&s=8ca1e3b3af7685ecfda5e41784287ae2" alt="Testing SQL" width="800" data-path="images/develop/api-proxy-olusturma/db-api-sql-test.png" />

<Info>
  If a **null** value is desired to be sent for testing, it is sufficient to write **null** as the parameter.
</Info>

## Creating API Proxy from DB-2-API

When there is at least one *Method/Endpoint*, an API Proxy is created for DB-2-API by clicking the **Create API Proxy** button.

<Warning>
  At least one *Method/Endpoint* must exist to create an API Proxy from DB-2-API.
</Warning>

The API Proxy is created by entering the required fields for the API Proxy on the screen that appears and clicking the **Save** button.

<img src="https://mintcdn.com/apinizer/brWu4H3JyK0OgbJV/images/develop/api-proxy-olusturma/db-api-proxy-olusturma.png?fit=max&auto=format&n=brWu4H3JyK0OgbJV&q=85&s=b946a7939030247ae4263b9a7cd1b1b9" alt="API Proxy creation" width="800" data-path="images/develop/api-proxy-olusturma/db-api-proxy-olusturma.png" />

After this step, what can be done is exactly the same as the API Proxy document. You can refer to the [API Proxy Creation](/en/develop/api-proxy-creation/api-proxy-creation) page for details.

<Info>
  You can create multiple API Proxies from one DB-2-API.
</Info>

## Deploy/Redeploy

To view and manage API Proxies in DB-2-API, click the **Manage API Proxies** link and they are viewed and managed from the opened window. In the opened window, Deploy/Undeploy and Redeploy operations for API Proxies created with DB-2-API are performed in this section.

To deploy the API Proxy, click the **Manage API Proxies** link and press the deploy icon.

<img src="https://mintcdn.com/apinizer/brWu4H3JyK0OgbJV/images/develop/api-proxy-olusturma/db-api-proxy-yonetme.png?fit=max&auto=format&n=brWu4H3JyK0OgbJV&q=85&s=5e5639af73570b28e48e281cdd39afcf" alt="API Proxy management" width="600" data-path="images/develop/api-proxy-olusturma/db-api-proxy-yonetme.png" />

After the above operation, confirmation is required. Information about the deployment operation is created and the **(Deploy) Deploy** button is clicked.

<img src="https://mintcdn.com/apinizer/brWu4H3JyK0OgbJV/images/develop/api-proxy-olusturma/db-api-deploy.png?fit=max&auto=format&n=brWu4H3JyK0OgbJV&q=85&s=1ff7f6bd8448377be6877eb901ef0abc" alt="Deploy screen" width="600" data-path="images/develop/api-proxy-olusturma/db-api-deploy.png" />

When a new *Method/Endpoint* is added to DB-2-API or one of the existing *Method/Endpoint*s is updated, all API Proxies must be redeployed.

When you add a new *Method/Endpoint* or update an existing *Method/Endpoint*, a notification like the following will appear.

<img src="https://mintcdn.com/apinizer/brWu4H3JyK0OgbJV/images/develop/api-proxy-olusturma/db-api-yeniden-yukleme-bildirimi.png?fit=max&auto=format&n=brWu4H3JyK0OgbJV&q=85&s=05cfdf8e1ff53cf220f11bdc95c99e71" alt="Redeploy notification" width="600" data-path="images/develop/api-proxy-olusturma/db-api-yeniden-yukleme-bildirimi.png" />

By saying **Redeploy Required**, changes are applied to API Proxies.

<img src="https://mintcdn.com/apinizer/brWu4H3JyK0OgbJV/images/develop/api-proxy-olusturma/db-api-redeploy.png?fit=max&auto=format&n=brWu4H3JyK0OgbJV&q=85&s=abf436c7e239b427c6ce352660e0d525" alt="Redeploy screen" width="600" data-path="images/develop/api-proxy-olusturma/db-api-redeploy.png" />

After the above operation, confirmation is required. Information about the redeployment operation is created and the **(Redeploy) Redeploy** button is clicked.

<img src="https://mintcdn.com/apinizer/brWu4H3JyK0OgbJV/images/develop/api-proxy-olusturma/db-api-redeploy-onay.png?fit=max&auto=format&n=brWu4H3JyK0OgbJV&q=85&s=30c8516ef1f41eb8d934d6c3d80be454" alt="Redeploy confirmation screen" width="600" data-path="images/develop/api-proxy-olusturma/db-api-redeploy-onay.png" />

From the DB-2-API page, go to the API Proxy by clicking the link in the API Proxy's name.

<img src="https://mintcdn.com/apinizer/brWu4H3JyK0OgbJV/images/develop/api-proxy-olusturma/db-api-proxy-link.png?fit=max&auto=format&n=brWu4H3JyK0OgbJV&q=85&s=cba3da76a542be6505b95139a45193de" alt="Link from DB-2-API to API Proxy" width="600" data-path="images/develop/api-proxy-olusturma/db-api-proxy-link.png" />

Similarly, to go to the DB-2-API page from the API Proxy page, go by clicking the DB-2-API name in the API Proxy as shown below.

<img src="https://mintcdn.com/apinizer/brWu4H3JyK0OgbJV/images/develop/api-proxy-olusturma/db-api-geri-link.png?fit=max&auto=format&n=brWu4H3JyK0OgbJV&q=85&s=6dfd1a9c4330fbdb394a8635edcd83d6" alt="Link from API Proxy to DB-2-API" width="600" data-path="images/develop/api-proxy-olusturma/db-api-geri-link.png" />

## DB-2-API Deletion

When a DB-2-API is deleted, all API Proxies connected to it are first removed (Undeploy) and then deleted.
