Skip to content

Resource groups and endpoints ​

Endpoints are the routes of your API, for example GET /products. They're organized in resource groups, usually one group per kind of data: products, orders, customers…

Groups and endpoints belong to the release selected in Active Releases. They're managed in REST API projects: in an IAM project, endpoints are shown as read-only, and an Analytic API project has no endpoints section.

Resource groups ​

Add a group ​

  1. In the endpoints toolbar, click Add Resource Group.
  2. Enter the Name (required) and, if you like, a Description.
  3. Click Confirm.

The name must be unique in the release (case doesn't matter), and must not start or end with a space.

Keep at least one group

The toolbar buttons (Add Resource Group, Add Endpoint, Test and validate) are only shown if the release contains at least one group.

Edit or delete a group ​

On the group's header:

  • ✎ edits the name or description;
  • the trash icon deletes the group.

Permanent deletion

After you confirm in the Delete Resource Group window, the group is deleted together with all its endpoints.

The Authentication Grizzly group ​

When you create a REST API with security enabled, Grizzly automatically adds the Authentication Grizzly group. It contains your API's authentication endpoints, for example POST /signin (sign in), POST /signup (sign up) or GET /allroles.

This group is managed by Grizzly: you can't edit or delete it, nor edit or delete its endpoints. Their access roles are shown as read-only.

Add an endpoint ​

Click Add Endpoint on the header of the group where you want to create it. Prefer this button to the toolbar one, which adds the endpoint to the first group in the list.

The wizard has seven steps.

1. Endpoint Definition ​

  • HTTP Method: GET, POST, PUT or DELETE. The list still shows PATCH, HEAD and OPTIONS, but these methods are not supported: don't choose them (see Call an API).
  • Path: it starts with / and only contains letters, numbers, _, -, / and parameters in braces, for example /products/{reference}. Two endpoints can't have the same method and path.
  • Summary and Description: what the endpoint does. They appear in the API documentation.
  • Parameters: click Add Parameter and set where it is (Query, Header, Path or Body), its Name, its Type and whether it's Required.

Parameters added automatically

Each {name} in the path becomes a required Path parameter. For POST and PUT, a body parameter is added for the request body.

2. Content Types ​

Choose the Content Type of the request and the response (application/json by default). You can also attach a Request Model and a Response Model, or create one with Add model.

3. Execution Request ​

This is where you say what the endpoint does on the database.

  • Query Type: Read, Insert, Update, Delete or Execute. It's chosen automatically from the method (GET → Read, DELETE → Delete, PUT → Update, POST → Insert), and you can change it.
  • Request Cardinality and Response Cardinality: Object for a single item, Array for a list.
  • The Collection (Table for a SQL database, Index for Elasticsearch). With MongoDB, Add New Collection creates a new one.
  • Enable Pagination (for a read GET): the response is split into pages.
  • Query: the filter or query to run. Use %name to insert a parameter's value, for example {"reference": "%reference"}. Format Query formats the text.

4. Functions ​

You can plug in custom code:

  • an Input Function, run before the query (for example to validate the incoming data);
  • an Output Function, run after it (for example to format the response).

Choose an existing function or create one with Create Function. This step is optional.

5. Responses ​

Describe the possible responses: Code (for example 200, 404), Description and Schema. Add Response adds another one.

6. Documentation ​

The Summary and an optional External documentation link.

7. Summary ​

Check the summary (path, method, access roles, number of parameters, query type and collection), then click Create.

Example: the store catalog ​

In the Store project, create a products group with Add Resource Group, then add three endpoints to that group:

EndpointQuery TypeResponseQuery
GET /productsReadArray{} (all products)
GET /products/{reference}ReadObject{"reference": "%reference"}
POST /productsInsertObjectthe request body is saved in the collection

Choose the products collection in the Execution Request step; if it doesn't exist yet, create it with Add New Collection.

Edit or delete an endpoint ​

On the endpoint's card:

  • ✎ reopens the wizard with the current values. Finish with Update;
  • the trash icon deletes the endpoint, after confirmation.

Choose who can call an endpoint ​

Each endpoint shows its access roles. They only protect the endpoint if the project's security is enabled. Click them to open Access Roles:

RoleWho can call the endpoint
publicAnyone, without authentication (default)
allAll authenticated users
adminAdministrators only
userStandard users
Custom roleUsers who have this role in the project

Select at least one role, then click Save. For example, so that only administrators can add products, give the admin role to POST /products and leave GET /products as public.

What's next? ​

Grizzly API · CodeOnce Software