Skip to main content

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.

Image from Gyazo

The main menu buttons appear at the top of the endpoint list screen.

Image from Gyazo

[Add]

Opens the API editor.

Image from Gyazo

ItemDescription
TitleTitle of the API (required field).
VersionVersion of the API (required field).
DescriptionOverview of the API (required field).
SortEnter the order of the APIs. They will be arranged in descending order.
AddClick to create the API.

[Swagger UI]

Redirects to the Swagger UI screen for the current API.

Image from Gyazo

(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.

Image from Gyazo (See: API Security for details.)

[Operation CORS]

To enable CORS, customize the information that the Kuroco server returns to the response header.

Image (fetched from Gyazo) 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.)

ItemCorresponding response headerSample http://localhost:8080
CORS_ALLOW_ORIGINSAccess-Control-Allow-Originhttp://localhost:8080
CORS_ALLOW_METHODSAccess-Control-Allow-MethodsGET,POST,OPTIONS
CORS_ALLOW_HEADERSAccess-Control-Allow-Headers*
CORS_MAX_AGEAccess-Control-Max-Age600
CORS_ALLOW_CREDENTIALSAccess-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.

Image from Gyazo 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.

Image from Gyazo 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.

Image from Gyazo

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.

Image (fetched from Gyazo) (See: Reference - API - Endpoint settings for more details.)

Endpoint list

A list of endpoints for the current API is displayed below the main menu.

Image from Gyazo This list appears only after you have added endpoints to a new API. The endpoints are grouped by category.

ItemDescription
EnabledIndicates whether the API is enabled or disabled.
MethodHTTP method.
PathPath of the endpoint.
ModelThe Kuroco model bound to the endpoint.
OperationThe operations associated with the model.
SummaryValue specified when creating the endpoint.
ParametersOperation parameters.
AuthenticationMethod 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.

Image from Gyazo

Click the "Changelog" to see a list of the history of editing the endpoint settings.

Image from Gyazo

Endpoint settings changelog

Image from Gyazo

Item  Description  
VersionDisplays the version.
You can see the target version after clicking the version link.
Updated onDisplays the date and time the content was updated.
Updated byDisplays the name of the member who updated the content.
ActionDisplays the type of processing performed.
There are six types of statuses as follows
  • Create new
  • Update
  • Deleted
  • Request
  • Approved
  • Reject Approval
CommentDisplays the comments at the time of update.
ContentDisplays the updated contents.

Support

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