logologo
Get Started
Guide
Development
Plugins
API
English
简体中文
Get Started
Guide
Development
Plugins
API
English
简体中文
logologo
Overview

Data sources

Data source manager
Main data source

External data sources (Databases)

Overview
External MySQL
External MariaDB
External PostgreSQL
External MSSQL
External Oracle
Main vs External Databases
REST API data source
KingbaseES data source

Collections

Overview
General collection
Inheritance collection
File collection
Tree collection
Calendar collection
Comment collection
Expression collection
SQL collection
View collection

Collection fields

Overview
Field Validation

Basic

Single text
Long text
Phone
Email
URL
Integer
Number
Percent
Password
Color
Icon

Choices

Checkbox
Select
Multiple select
Radio group
Checkbox group

Media

Markdown
Markdown (Vditor)
Rich text
Attachment (Relationship)
Attachment (URL)

Date & Time

Overview
Date & time (with timezone)
Date & time (without timezone)
Unix timestamp
Date (without time)
Time

Geometry

Point
Line
Circle
Polygon

Advanced

UUID
Nano ID
Sort
Formula
Sequence
JSON
Collection select
Encryption

System info

Created at
Updated at
Created by
Last updated by
Space
Table OID

Associations

Overview
One to one
One to many
Many to one
Many to many
Many to many (array)

Development

Overview
Previous PageMain vs External Databases
Next PageKingbaseES data source

#REST API Data Source

#Introduction

This plugin allows you to integrate data from REST API sources seamlessly.

#Installation

As a commercial plugin, it requires uploading and activation through the plugin manager.

20240323162741

#Adding a REST API Source

After activating the plugin, you can add a REST API source by selecting it from the Add new dropdown menu in the data source management section.

20240721171420

Configure the REST API source.

20240721171507

#Adding a Collection

In NocoBase, a RESTful resource is mapped to a Collection, such as a Users resource.

GET /users
POST /users
GET /users/1
PUT /users/1
DELETE /users/1

These API endpoints are mapped in NocoBase as follows:

GET /users:list
POST /users:create
POST /users:get?filterByTk=1
POST /users:update?filterByTk=1
POST /users:destroy?filterByTk=1

For a comprehensive guide on NocoBase API design specifications, refer to the API documentation.

20240716213344

Check the "NocoBase API - Core" chapter for detailed information.

20240716213258

The Collection configuration for a REST API data source includes the following:

#List

Map the interface for viewing a list of resources.

20240716211351

#Get

Map the interface for viewing resource details.

20240716211532

#Create

Map the interface for creating a resource.

20240716211634

#Update

Map the interface for updating a resource.

20240716211733

#Destroy

Map the interface for deleting a resource.

20240716211808

Both the List and Get interfaces are required to be configured.

#Debugging the API

#Request parameter integration

Example: Configure pagination parameters for the List API. If the third-party API does not support pagination natively, NocoBase will paginate based on the retrieved list data.

20241121205229

Please note that only variables added in the interface will take effect.

Third-party API params nameNocoBase params
page{{request.params.page}}
limit{{request.params.pageSize}}

You can click Try it out to debug and view the response.

20241121210320

#Response format transformation

The response format of the third-party API may not be in NocoBase standard, and it needs to be transformed before it can be correctly displayed on the front end.

20241121214638

Adjust the conversion rules based on the response format of the third-party API to ensure the output conforms to the NocoBase standard.

20241121215100

Debugging process description

20240717110051

#Variables

The REST API data source supports three types of variables for API integration:

  • Custom data source variables
  • NocoBase request variables
  • Third-party response variables

#Custom Data Source Variables

20240716221937

20240716221858

#NocoBase Request

  • Params: URL query parameters (Search Params), which vary depending on the interface.
  • Headers: Custom request headers, primarily providing specific X- information from NocoBase.
  • Body: The request body.
  • Token: The API token for the current NocoBase request.

20240716222042

#Third-Party Responses

Currently, only the response body is available.

20240716222303

Below are the variables available for each interface:

#List

ParameterDescription
request.params.pageCurrent page
request.params.pageSizeNumber of items per page
request.params.filterFilter criteria (must meet NocoBase Filter format)
request.params.sortSorting criteria (must meet NocoBase Sort format)
request.params.appendsFields to load on demand, typically for association fields
request.params.fieldsFields to include (whitelist)
request.params.exceptFields to exclude (blacklist)

#Get

ParameterDescription
request.params.filterByTkRequired, typically the current record ID
request.params.filterFilter criteria (must meet NocoBase Filter format)
request.params.appendsFields to load on demand, typically for association fields
request.params.fieldsFields to include (whitelist)
request.params.exceptFields to exclude (blacklist)

#Create

ParameterDescription
request.params.whiteListWhitelist
request.params.blacklistBlacklist
request.bodyInitial data for creation

#Update

ParameterDescription
request.params.filterByTkRequired, typically the current record ID
request.params.filterFilter criteria (must meet NocoBase Filter format)
request.params.whiteListWhitelist
request.params.blacklistBlacklist
request.bodyData for update

#Destroy

ParameterDescription
request.params.filterByTkRequired, typically the current record ID
request.params.filterFilter criteria (must meet NocoBase Filter format)

#Field Configuration

Field metadata (Fields) is extracted from the CRUD interface data of the adapted resource to serve as the fields of the collection.

20240716223636

Extract field metadata.

20241121230436

Fields and preview.

20240716224403

Edit fields (similar to other data sources).

20240716224704

#Adding REST API Data Source Blocks

Once the collection is configured, you can add blocks to the interface.

20240716225120