API
On the endpoint list screen for each API, you can create and configure APIs as well as endpoints.
Accessing the screen
In the left sidebar menu, click [API] and select the API you want to look at.
Main menu
The main menu buttons appear at the top of the endpoint list screen.
[Add]
Opens the API editor.
Item | Description |
---|---|
Title | Title of the API (required field). |
Version | Version of the API (required field). |
Description | Overview of the API (required field). |
Sort | Enter the order of the APIs. They will be arranged in descending order. |
Add | Click to create the API. |
[Swagger UI]
Redirects to the Swagger UI screen for the current API.
(See: Using Swagger UI to check the data structure of your content for details).
[Clear cache]
Clears the settings cache of the current API. Any changes to Kuroco's internal behavior clears the cache and applies/reflects the latest version.
[Security]
Configures the security settings for the current API.
(See: API Security for details.)
[Operation CORS]
To enable CORS, customize the information that the Kuroco server returns to the response header.
The origin configured for CORS is the one assigned in the Content-Security-Policy: frame-ancestors. For example, to access the Kuroco server from the local frontend http://localhost:8080
, configure http://localhost:8080
as follows.
(See: MDN Web Docs for details.)
Item | Corresponding response header | Sample http://localhost:8080 |
---|---|---|
CORS_ALLOW_ORIGINS | Access-Control-Allow-Origin | http://localhost:8080 |
CORS_ALLOW_METHODS | Access-Control-Allow-Methods | GET,POST,OPTIONS |
CORS_ALLOW_HEADERS | Access-Control-Allow-Headers | * |
CORS_MAX_AGE | Access-Control-Max-Age | 600 |
CORS_ALLOW_CREDENTIALS | Access-Control-Allow-Credentials | ✅ |
[Update API]
Updates the settings of the current API. The input fields are the same as the Add section.
[Delete API]
Deletes the current API.
Note: Deleted APIs cannot be recovered.
[Export API]
Exports the current API in JSON/YAML format.
The exported configuration file is in Kuroco's own format. To include pre-/post-processing settings, check the "Including pre/post processing blocks" box.
[Import API]
Imports the current API in JSON/YAML format.
Select "Import as new API" to create a new API. Selecting "Import to the current API" updates the current API.
[OpenAPI Export]
Exports the current API in JSON/YAML format.
The exported files are configuration files formatted according to the OpenAPI specification.
They are intended to be used throughout the entire development lifecycle, including documenting APIs, automatically generating client and server code, and creating API tests and mocks.
Sample
openapi: 3.1.0
info:
title: Default
version: '1.0'
description: 'Default API'
servers:
-
url: 'https://xxxxxx.g.kuroco.app'
description: 'API Backend'
paths:
/rcms-api/1/news/list:
get:
tags:
- Content
summary: ''
parameters:
-
name: _output_format
schema:
type: string
format: ''
in: query
required: false
style: form
explode: true
description: 'Format (json|xml|csv|zip)'
-
name: _lang
schema:
type: string
format: ''
in: query
required: false
style: form
explode: true
description: Language
-
name: _charset
schema:
type: string
format: ''
in: query
required: false
style: form
explode: true
description: Charset
-
name: cnt
schema:
type: integer
format: int64
in: query
required: false
style: form
explode: true
description: 'Number of entries per page'
-
name: pageID
schema:
type: integer
format: int64
in: query
required: false
style: form
explode: true
description: 'Page ID'
-
name: filter
schema:
type: string
format: ''
in: query
required: false
style: form
explode: true
description: 'Filter query'
responses:
200:
description: 'Topics data successfully fetched'
404:
description: 'Topics data could not be found'
・
・
・
[Add new endpoint]
Opens the "Add new endpoint" pop-up screen.
(See: Reference - API - Endpoint settings for more details.)
Endpoint list
A list of endpoints for the current API is displayed below the main menu.
This list appears only after you have added endpoints to a new API. The endpoints are grouped by category.
Item | Description |
---|---|
Enabled | Indicates whether the API is enabled or disabled. |
Method | HTTP method. |
Path | Path of the endpoint. |
Model | The Kuroco model bound to the endpoint. |
Operation | The operations associated with the model. |
Summary | Value specified when creating the endpoint. |
Parameters | Operation parameters. |
Authentication | Method of authentication. |
[Update] | Opens the "Configure endpoint" pop-up screen. |
[Pre-processing] | Displays the pre-processing settings editor. The total number of pre-processes that have been set will be displayed. |
[Post-processing] | Displays the post-processing settings editor. The total number of post-processes that have been set will be displayed. |
[Delete] | Deletes the endpoint. |
Changelog
You can see a list of the history of editing from the endpoint settings screen.
Click the "Update" in the endpoint list, then open the endpoint settings.
Click the "Changelog" to see a list of the history of editing the endpoint settings.
Endpoint settings changelog
Item | Description |
---|---|
Version | Displays the version. You can see the target version after clicking the version link. |
Updated on | Displays the date and time the content was updated. |
Updated by | Displays the name of the member who updated the content. |
Action | Displays the type of processing performed. There are six types of statuses as follows
|
Comment | Displays the comments at the time of update. |
Content | Displays the updated contents. |
Related documents
- Configuring endpoints
- Points to note after endpoint configuration
- How to check the data structure using Swagger UI
- How to get the origin country/region of API requests
- Creating a custom function endpoint
- Dynamically Changing API Response with Login User Information
- Setting up stubs on API endpoints using custom functions
- How to implement original validation in API by using custom function
- Overwriting request values passed to API main processes using custom functions
- Endpoint settings
- Pre-processing
- Post-processing
- Using the filter query function
- Filter function based on related data
- API cache
- Timing and scope of API cache clearing
- Can the API respond in formats other than JSON?
Support
If you have any other questions, please contact us or check out Our Slack Community.