Skip to content

Your first API with forms ​

This guide builds a simple API step by step: a data source, a project, then an endpoint that you test.

1. Add a data source ​

  1. In the left menu, click Data sources, then New Data Source.
  2. At the Select type step, choose Relational (SQL) or Document (NoSQL), then click Next.
  3. At the Select provider step, choose for example MongoDB or PostgreSQL.
  4. For MongoDB, also choose the Connection Mode:
    • Free: a database hosted by Grizzly, great for trying things out; you only need to give it a name;
    • Cloud: a cloud database (for example MongoDB Atlas), with its connection string;
    • On-Premise: your own server (host, port, credentials).
  5. At the Fill connection step, fill in the requested information. For a direct connection: the Connection Name, the Database, the Host, the Port and, if the database requires authentication, the Username and Password. Click Test connection to check the settings, then Next.
  6. At the Review step, check the summary, then click Save (or Create Database for a free database).

To try it quickly

Choose MongoDB in Free mode: there is nothing to install.

2. Create a project ​

  1. In the menu, click Projects, then New Microservice (or Create your first project if you don't have any project yet).
  2. Select Project Type: choose REST API, then click Next.
  3. Project Details: give it a unique Project Name (unaccented letters, numbers, spaces and _, for example "Inventory") and, if you wish, a Description.
  4. Database Configuration: choose the data source created in step 1, then its Database.
  5. Review: check the information, then click Validate.

Grizzly creates the project with a first release, 1.0.0.

3. Add an endpoint ​

  1. Open your project from the Projects page.

  2. In the Endpoints section, the project already contains an Untitled resource group. Use it, or create your own group with Add Resource Group, for example products.

  3. On this group, click Add Endpoint. The wizard guides you step by step:

    • Endpoint Definition: the HTTP Method (GET, POST, PUT, DELETE…), the Path, for example /products, and any Parameters (in the query, a header, the path or the body);
    • Execution Request: the collection or table, and whether the endpoint returns an object or an array;
    • Responses: the possible response codes (200, 404…).

    For this first endpoint, the other steps (Content Types, Functions, Documentation) can stay as they are.

  4. At the Summary step, check the endpoint, then click Create.

4. Test your API ​

  • On the project page, the Runtime URL is the address of your API. Each endpoint is available at this address followed by its path.
  • In the Endpoints section, click Test and validate to open the Swagger interface and call your endpoints from the browser.
  • You can also call an endpoint with Postman or curl, by adding its path to the runtime URL:
bash
curl https://<runtime-url>/products

What's next? ​

  • Protect your API with roles: see Secure an API. Security is enabled when the project is created.
  • Export your API's contract with Export OpenAPI contract (JSON or YAML).
  • Share your project with your team with Share.

Grizzly API · CodeOnce Software