Creating API
This document explains how to use the API to create new records in a table.
Interface Description
Creates a new record in a specified table.
Request Method
http
POST /api/bases/{base_id}/tables/{table_name}/records
Path Parameters
Parameter | Type | Description |
---|---|---|
base_id | string | Base ID |
table_name | string | Table name |
Request Headers
http
x-bm-token: your_api_token
Content-Type: application/json
Request Body
json
{
"fields": {
"field_name1": "value1",
"field_name2": "value2"
}
}
Example Requests
Basic Field Creation
http
POST /api/bases/base123/tables/table456/records
Content-Type: application/json
{
"id": 156,
"name": "Test Record",
"description": "This is a test record",
"age": 25,
"is_active": true
}
Select Field Creation
http
POST /api/bases/base123/tables/table456/records
Content-Type: application/json
{
"status": "opt123", // Single-select field uses option ID
"tags": ["opt456", "opt789"] // Multi-select field uses option ID array
}
Response Format
Successful Response
json
{
"id": "11",
"name": "test",
"created_by": "usrIL1t20OwVvW9jXzT",
"updated_by": "usrIL1t20OwVvW9jXzT",
"created_at": "2024-11-20T17:30:12.000Z",
"updated_at": "2024-11-20T17:30:27.000Z",
"creator": {
"id": "usrIL1t20OwVvW9jXzT",
"email": "[email protected]",
"name": "Dylan"
},
"modifier": {
"id": "usrIL1t20OwVvW9jXzT",
"email": "[email protected]",
"name": "Dylan"
}
}
Error Response
json
{
"message": "Validation failed",
}
Field Value Format Explanation
Request formats for different types of fields:
Basic Type
json
{
"text_field": "text content",
"number_field": 123.45,
"boolean_field": true,
"date_field": "2023-01-01T00:00:00Z"
}
Select Type
json
{
"single_select": "opt123", // Option ID
"multiple_select": ["opt123", "opt456"] // Option ID array
}
Link Type
json
{
"single_link": "rec123", // Record ID
"multiple_link": ["rec123", "rec456"] // Record ID array
}
Notes
- When creating a record, the following fields are automatically filled:
- Creation time
- Update time
- Creator
- Updater
- Auto-increment ID (if applicable)