N8n DataTables API for Columns Management (Add, Delete, Rename column)

hello @selbainu in the meantime, while waiting for the such specific actions from n8n official node, you can use http request to do so :

First of all you need to get the cookie to be used to authenticate the API requests :

- URL : {{ your_n8n_instance_URL }}/rest/login

- method : POST

- payload :

{
"emailOrLdapLoginId":"your_email_address"
,"password":"your_password"
}

use below option to get the headers in the API response :

The cookie to use for next API requests is the below one : {{ $json.headers[“set-cookie”][0] }}

  • Add column from n8n table :

- URL : https://yourn8naccount.app.n8n.cloud/rest/projects/{{ yourPorjectId}}/data-tables/{{ n8n_table_ID }}/columns

- method : POST

- header :

{
"Cookie" : "{{ $json.headers[“set-cookie”][0] }}"
}

- payload :

{
"name":"Column_name_here",
"type":"string"
}

The different possible values for “type” : string, number, boolean, date

  • Rename column from n8n table :

- URL : https://yourn8naccount.app.n8n.cloud/rest/projects/{{ yourPorjectId}}/data-tables/{{ n8n_table_ID }}/columns/{{ n8n_column_ID }}/rename

- method : PATCH

- header :

{
"Cookie" : "{{ $json.headers[“set-cookie”][0] }}"
}

- payload :

{
"name":"newcol_updated"
}

To get the {{ n8n_column_ID }} just run below http request :

GET : https://yourn8naccount.app.n8n.cloud/rest/projects/{{ yourPorjectId}}/data-tables?filter={“projectId”:“{{ yourPorjectId}}”,“id”:“{{ n8n_table_ID }}”}

Response example with expected {{ n8n_column_ID }} => DiNjfl83CrrXXcoj

  • Delete column from n8n table :

- URL : https://yourn8naccount.app.n8n.cloud/rest/projects/{{ yourPorjectId}}/data-tables/{{ n8n_table_ID }}/columns/{{ n8n_column_ID }}

- method : DELETE

- header :

{
"Cookie" : "{{ $json.headers[“set-cookie”][0] }}"
}
1 Like