How do i make a new table in my localhost baserow using API?
Good morning @lanvinpierre,
Please see this section of our API documentation for information on how a new table is created.
Cheers,
Peter Evans
i think i got that part right. im having trouble with authentication? i dont think im using the right headers. it needs JWT instead of just the api token right?
this is how im trying to use it. i think im getting something wrong
error: “ERROR_FEATURE_NOT_AVAILABLE”
detail: “The related user does not have access to these features.” does this mean i need premium to have access to it?
Yes, out of curiosity, which endpoint are you trying to use?
Usually, in our docs, we show which endpoints are PREMIUM
and which are not.
https://api.baserow.io/api/database/tables/database/{database_id}/ this one. on a selfhost. i only want to make new tables. which im having trouble with
if you can confirm that making new tables via API is a premium feature then thatl help a lot haha since ive been trying for a week with this
Hi, can you please confirm the:
- Endpoint you are POSTing pointing to.
- Payload you’re sending.
- That you’re setting an
Authorization
header with your JWT token.
Cheers,
Peter Evans
http://localhost/api/database/data-sync/database/159/
{ “synced_properties”: [ “Prompt ID” ], “type”: “local_baserow_table”, “table_name”: “testingtable”, “source_table_id”: 669 }
yup my authorization is JWT token, that parts working.
as i understand this should copy an existing table? however i am fine with just an empty table. that would work better for me. would very much appreciate the help.
if im using the right endpoint or what payload to achieve an empty table. thank you
Hi,
Your initial post was regarding creating a new table. To do so, please use the “Request” section in the documentation, you only need to provide a name
at minimum:
POST /api/database/tables/database/{databaseId}/
With data:
{
"name": "test"
}
This will result in a new table being created.
What you are doing however is creating a data-synced table. The following works for me:
POST /api/database/data-sync/database/{databaseId}/
{
"synced_properties": [],
"table_name": "test",
"type": "local_baserow_table",
"source_table_id": 718
}
Cheers,
Peter Evans
THANK YOU!!! saved me a weeks worth of work!
{
“name”: msg.tablename,
“data”: [ [“PROMPT ID”, “NAME”],
[“row2_field1_value”, “row2_field2_value”] ],
“first_row_header”: true
} hi one more thing. how do i change the type of field ie the “prompt id” to be “uuid” and if you could lead me to the docs for that part as i cant see it anywhere. thank you!
Hi @lanvinpierre,
After creating a data synced table, it’s not yet possible to change the synced_properties
afterwards. This will come in an upcoming release, however.
Cheers,
Peter Evans