Skip to main content

Configuring endpoints

Kuroco allows the creation of custom endpoints.
In this tutorial, we will find out what endpoints are and how to create them.

What is an endpoint

An endpoint is a URL that exposes a feature within Kuroco publicly.

For example, to display a list of news on a website, the website needs to get the news list from Kuroco.

To achieve that, Kuroco must prepare a URL that says, "If this URL is accessed, the list of articles will be returned as a result." That URL is an endpoint.

Difference between API and endpoint

Endpoints are often referred to as API.
API is an acronym for "Application Programming Interface" and refers to an interface that provides functions externally.

Kuroco defines the word "API" as a concept that represents the grouping of related endpoints.

Image (fetched from Gyazo)

How to group APIs

In Kuroco, each API will have its own security settings and CORS settings.
Therefore, it is recommended to group APIs according to the following criteria.

  • Called by the same external system
  • Called by multiple external systems with similar authentication methods

How to create an endpoint

Now let's actually create an endpoint.
Assuming that the news topic group has already been created, set the endpoint to get the news list.

  • Group ID: 1
  • Group name: Notice

1. Settings overview
Access the API list page from the API menu on the management screen.
From the side menu, select [API] -> [Default].
Image from Gyazo

Click [Add new endpoint]. Image from Gyazo

The configure endpoint pop-up will be displayed. Image from Gyazo

2. Specify the path - URI
Set the path as "news". Set to "Enabled".

tip

In Kuroco, the path is always prefixed with /rcms-api/X/.
X is an integer that refers to the API ID. Fill in the rest of the path text after the prefix.

3. Specify the content and operation to be processed
Next, specify the content. Under Model, select:

  • Category: Content
  • Model: news, v1
  • Operation: list

The summary and description fields are optional. Please write a brief overview of the endpoint in the description field. Image from Gyazo

4. Setting up the parameters
There are many settings for an endpoint. In this exercise, the following 2 parameters will be set.

  • news_group_id: 1
  • cnt: 10

The "news_group_id" parameter refers to the topic group ID. Enter 1 here, which is the topic group ID for News.
The "cnt" parameter determines the number of articles displayed per page. Enter 10 here to display up to 10 articles per page.
Image from Gyazo

After setting up the parameters, click "Add" at the bottom of the page. Image from Gyazo

Checking the configured endpoint

Check the endpoint that was set up. On the backend API page, click on the [Default] dropdown menu and click [Swagger UI] to display the API Swagger UI detail page. Image from Gyazo

In the BackendAPI Swagger UI detail page, click on the newly created endpoint. Image from Gyazo

The endpoint information will be displayed. Image from Gyazo

This concludes the endpoint configuration.

caution

Incorrectly configured endpoints may cause unexpected information leaks. For details about endpoint configuration, see Tutorial: Points to note after endpoint configuration for detailed configuration.


Support

If you have any other questions, please contact us or check out Our Slack Community.