Modify Tables

Learn to update and delete table columns and rows using the Tables API.

Update a table

After creating a table, we might want to make some changes to that table. HubDB API provides us with an endpoint that is used to update an existing table. We need to send a PATCH request to this endpoint to add or delete columns in a table. Also, we can restore an archived table using this endpoint.

The base URL for this endpoint is as follows:

https://api.hubapi.com/cms/v3/hubdb/tables/{tableIdOrName}/draft

Note: Changes made through this endpoint are applied to the table's draft version. We will have to use the publish table endpoint to push the changes in the table's published version.

We need to provide the tableId of the table we want to update as a path parameter to this endpoint. This endpoint also accepts some additional parameters. The following table gives details about these parameters:

Request parameters

Parameter

Type

Parameter Type

Category

Description

id

string

path

required

The ID of the table we want to update

name

string

body

required

The internal name of the table

label

string

body

required

The table label that is visible to users

useForPages

boolean

body

optional

This value specifies whether the table data can be used to create dynamic pages.

columns

array[object]

body

optional

This is an array containing the details of the columns. These include name, label, type, and options.

Note: We need to provide all the columns (existing and new) as input. Otherwise, they will be deleted.

Let's update the table we created by adding another column in the following widget:

...