Open API
Create Open API
When a table is created in Undb, the system automatically generates and synchronizes a related OpenAPI. A ‘API Preview’ button is then provided at the top of the table operation column for accessing the OpenAPI view.
Click on the ‘API Preview’ button in the left window to view the display interface of the Open API preview in the right window.
API Detail
The system automatically generated nine types of Application Programming Interfaces (APIs).
API name | Methods | Category |
---|---|---|
List table records | GET | Record |
Create table record | POST | Record |
Delete table records by ids | DELETE | Record |
Update table record | PATCH | Record |
Get table record by id | GET | Record |
Duplicate table record by id | POST | Record |
Delete table record by id | DELETE | Record |
Create table records bulk | POST | Record |
Update table records bulk | PATCH | Record |
Create table webhook | POST | Webhook |
Update table webhook | PATCH | Webhook |
Get table webhook | GET | Webhook |
Delete table webhook | DELETE | Webhook |
Subscribe table record events | GET | Subscribe |
- At the API preview interface, users can view the OpenAPI created for the corresponding table, as well as request and response examples for the API.
- The structure of the API will be automatically generated based on the corresponding table structure, as shown in the following figure.
Illustrating with the data table from the demo website
structure of the Table
structure of the API
// get list Company records
{
"records": [
{
"id": "rec16l53qwc",
"Company": "Company Name 1",
"createdAt": "2023-05-20T16:10:44.000Z",
"createdBy": {
"id": "usrzvhv8srb",
"username": "wanshufen",
"avatar": null,
"color": "blue"
},
"updatedAt": "2023-05-20T16:25:06.000Z",
"updatedBy": {
"id": "usrzvhv8srb",
"username": "wanshufen",
"avatar": null,
"color": "blue"
},
"Contacts": [
{
"id": "recqymnue1f",
"value": ["Ambrose"]
}
],
"Title": [
{
"id": "rec2qr07yes",
"value": ["CEO"]
}
],
"Title Name": "CEO"
}
]
}
structure of the table
structure of the API
// get list employees records
{
"records": [
{
"id": "recm1kabi9l",
"Employee": "Vincent",
"Title": "manager 1",
"createdAt": "2023-05-21T08:54:22.000Z",
"createdBy": {
"id": "usrzvhv8srb",
"username": "wanshufen",
"avatar": null,
"color": "blue"
},
"updatedAt": "2023-05-27T18:56:08.000Z",
"updatedBy": {
"id": "usrbuajh55q",
"username": "test",
"avatar": null,
"color": "rose"
},
"Level": 3,
"Employee ID": 1,
"subordinate": [
{
"id": "recvpmpb1bv",
"value": ["Ford"]
}
],
"Superior": {
"id": "recngzo73ge",
"value": ["Scott"]
}
}
]
}
Based on the example above, the interface generated for different data tables will also be different.