# SeaTable

> Read and update rows, tables, views and comments in a SeaTable base.

App · 20 actions. Web page: https://docs.lodol.com/docs/integrations/seatable

## Actions

### Append rows

Add up to 1,000 new rows to a table by its name, optionally filling empty cells with the columns' default values. Returns how many rows were inserted.

**Inputs**

- Table name (`table_name`, text, required): The name of the table to perform the operation on. Alternatively, you can use the `table_id` instead of `table_name`. If using `table_id`, ensure that the key in the request body is replaced accordingly.
- Rows (`rows`, list, required): Defines the rows which should be added. Maximum 1,000 rows per call.
- Apply default (`apply_default`, true/false): Use the column default values to populate new rows during creation. False by default.

**Outputs**

- `data` (object): Response.

**Example output**

```json
{
  "data": {
    "first_row": {},
    "inserted_row_count": 1,
    "row_ids": []
  }
}
```

### Create row comment

Add a comment to a row, picked by its table ID and row ID. Returns the new comment.

**Inputs**

- Table ID (`table_id`, text, required): Table ID.
- Row ID (`row_id`, text, required): Row ID.
- Comment (`comment`, text, required): Comment.

**Outputs**

- `data` (object): Response.

**Example output**

```json
{
  "data": {
    "comment": "example",
    "id": 1
  }
}
```

### Create table

Create a new, empty table with the given name in the connected base. Returns the new table with its ID and default columns.

**Inputs**

- Table name (`table_name`, text, required): The name of the table to perform the operation on. Alternatively, you can use the `table_id` instead of `table_name`. If using `table_id`, ensure that the key in the request body is replaced accordingly.

**Outputs**

- `data` (object): Response.

**Example output**

```json
{
  "data": {
    "_id": "example",
    "columns": [],
    "name": "example"
  }
}
```

### Create view

Create a new view on a table, either a normal or an archive view, optionally locked. Returns the new view.

**Inputs**

- Table name (`table_name`, text, required): Table name.
- Name (`name`, text, required): Name of the new view.
- Type (`type`, text, required): Type of the view, either normal view or a big data view. The default value is *table*. One of: `table`, `archive`.
- Is locked (`is_locked`, true/false): Is locked.

**Outputs**

- `data` (object): Response.

**Example output**

```json
{
  "data": {
    "_id": "example",
    "name": "example",
    "type": "example"
  }
}
```

### Delete comment

Delete a comment from a row by the comment's ID.

**Inputs**

- Comment ID (`comment_id`, number, required): Comment ID. At least 1.

**Outputs**

- `data` (object): Response.

**Example output**

```json
{
  "data": {}
}
```

### Delete row

Delete up to 10,000 rows from a table by their row IDs. Returns how many rows were deleted.

**Inputs**

- Table name (`table_name`, text, required): The name of the table to perform the operation on. Alternatively, you can use the `table_id` instead of `table_name`. If using `table_id`, ensure that the key in the request body is replaced accordingly.
- Row IDs (`row_ids`, list, required): Defines the rows which should be deleted. Maximum 10,000 row IDs per call.

**Outputs**

- `data` (object): Response.

**Example output**

```json
{
  "data": {
    "deleted_rows": 1
  }
}
```

### Delete table

Delete a table, picked by its name, from the connected base along with all of its rows.

**Inputs**

- Table name (`table_name`, text, required): The name of the table to perform the operation on. Alternatively, you can use the `table_id` instead of `table_name`. If using `table_id`, ensure that the key in the request body is replaced accordingly.

**Outputs**

- `data` (object): Response.

**Example output**

```json
{
  "data": {}
}
```

### Delete view

Delete a view from a table by its name. The table's rows are not affected.

**Inputs**

- View name (`view_name`, text, required): View name.
- Table name (`table_name`, text, required): Table name.

**Outputs**

- `data` (object): Response.

**Example output**

```json
{
  "data": {}
}
```

### Get comment

Get one row comment by its ID, returning its author, text, time and whether it is resolved.

**Inputs**

- Comment ID (`comment_id`, number, required): Comment ID. At least 1.

**Outputs**

- `data` (object): Response.

**Example output**

```json
{
  "data": {
    "author": "example",
    "comment": "example",
    "created_at": "example",
    "dtable_uuid": "example",
    "id": 1,
    "resolved": 1,
    "row_id": "example",
    "updated_at": "example"
  }
}
```

### Get metadata

Get the structure of the connected base, returning each table with its columns and views.

**Inputs**: None.

**Outputs**

- `data` (object): Response.

**Example output**

```json
{
  "data": {
    "metadata": {
      "tables": []
    }
  }
}
```

### Get row

Get one row from a table by its row ID, returning all of its cell values.

**Inputs**

- Row ID (`row_id`, text, required): Row ID.
- Table name (`table_name`, text, required): Table name.
- Convert keys (`convert_keys`, true/false): Convert keys.

**Outputs**

- `data` (object): Response.

**Example output**

```json
{
  "data": {}
}
```

### Get view

Get one view of a table by its name, returning its type, filters, sorts, grouping and hidden columns.

**Inputs**

- View name (`view_name`, text, required): View name.
- Table name (`table_name`, text, required): Table name.

**Outputs**

- `data` (object): Response.

**Example output**

```json
{
  "data": {
    "_id": "example",
    "name": "example",
    "type": "example"
  }
}
```

### List collaborators

List the people who can access the connected base, with each user's name, email address and ID.

**Inputs**: None.

**Outputs**

- `data` (object): Response.

**Example output**

```json
{
  "data": {}
}
```

### List columns

List the columns of a table by its name, optionally only those shown in one view. Returns each column's name, key and type.

**Inputs**

- Table name (`table_name`, text, required): Table name.
- View name (`view_name`, text): View name.

**Outputs**

- `data` (object): Response.

**Example output**

```json
{
  "data": {}
}
```

### List row comments

List the comments left on a row, picked by its row ID, with each comment's author, text and time.

**Inputs**

- Row ID (`row_id`, text, required): Row ID.

**Outputs**

- `data` (list): Response.

**Example output**

```json
{
  "data": []
}
```

### List rows

List the rows of a table by its name, optionally limited to one view. Returns one page of rows; use start and limit for the next page.

**Inputs**

- Table name (`table_name`, text, required): Table name.
- View name (`view_name`, text): View name.
- Start (`start`, number): Start.
- Limit (`limit`, number): Limit. From 1 to 1000.
- Convert keys (`convert_keys`, true/false): Convert keys.

**Outputs**

- `data` (object): Response.

**Example output**

```json
{
  "data": {
    "rows": []
  }
}
```

### List views

List the views of a table by its name, returning each view's name, type, filters and sorts.

**Inputs**

- Table name (`table_name`, text, required): Table name.

**Outputs**

- `data` (object): Response.

**Example output**

```json
{
  "data": {
    "views": []
  }
}
```

### Query sql

Run a SQL statement against the connected base, with optional parameters for any question marks in it. Returns the matching rows and their column metadata.

**Inputs**

- Sql (`sql`, text, required): SQL-Query to get rows from base.
- Convert keys (`convert_keys`, true/false): Determines if the columns are returned as their keys (false by default) or their names (true).
- Parameters (`parameters`, list): Parameters in SQL clause to avoid sql injection. Only needed, if you use `?` in the SQL statement. The parameters will replace the `?` according to their order in the array.
- Server only (`server_only`, true/false): Show rows from normal and Big Data backend (false by default) or limit the output only to the normal backend (true).

**Outputs**

- `data` (object): Response.

**Example output**

```json
{
  "data": {
    "metadata": [],
    "results": [],
    "success": false
  }
}
```

### Rename table

Rename a table in the connected base, picked by its current name. Returns the updated table.

**Inputs**

- Table name (`table_name`, text, required): The name of the table to perform the operation on. Alternatively, you can use the `table_id` instead of `table_name`. If using `table_id`, ensure that the key in the request body is replaced accordingly.
- New table name (`new_table_name`, text, required): New table name.

**Outputs**

- `data` (object): Response.

**Example output**

```json
{
  "data": {}
}
```

### Update row

Change cell values in up to 1,000 existing rows of a table, each picked by its row ID. Only the columns you supply are changed.

**Inputs**

- Table name (`table_name`, text, required): The name of the table to perform the operation on. Alternatively, you can use the `table_id` instead of `table_name`. If using `table_id`, ensure that the key in the request body is replaced accordingly.
- Updates (`updates`, list, required): Defines the rows which should be updated. Maximum 1,000 rows per call.

**Outputs**

- `data` (object): Response.

**Example output**

```json
{
  "data": {}
}
```
