Skip to main content

Hey,

I’m unable to add content as it gives unrecognized property and bad request. Here is my query:


mutation CreateTableBlock($docId: ID!, $type: DocBlockContentType!, $content: JSON!) {
create_doc_block(
doc_id: $docId,
type: $type,
content: $content
) {
id
}
}

{
"docId": 123456,
"type": "table",
"content": "{\\"column_count\\": 5, \\"row_count\\": 2, \\"deltaFormat\\": :{\\"insert\\":{\\"columns\\":5,\\"rows\\":"{\\"cells\\":"{\\"insert\\":\\"File\\"},{\\"insert\\":\\"Line\\"},{\\"insert\\":\\"Match\\"},{\\"insert\\":\\"Commit By\\"},{\\"insert\\":\\"Open ticket day\\"}]},{\\"cells\\":"{\\"insert\\":\\"path/to/file\\"},{\\"insert\\":\\"100\\"},{\\"insert\\":\\"example match\\"},{\\"insert\\":\\"username\\"},{\\"insert\\":\\"2024-03-05\\"}]}]}}]}"
}

Could you please check what’s wrong here.

Thanks in advance

I would suggest to check that content

step by step, that’s format always creates a issue for me as well


Thanks for the response.

However, I can’t find any specific format for type ‘table’. Could you share any example/reference.

Thanks


Hello there @niraj83 and welcome to the community!


I hope you like it here!


You can create the table:


mutation {
create_doc_block(
type: table
doc_id: 1234567
content: "{\\"column_count\\":4,\\"row_count\\":4}"
) {
id
}
}

Then query to get the ID of the cells in it:


{
docs(ids:123456){
blocks{
type
content
id
}
}
}

And then add data to the cells:


mutation {
create_doc_block(
parent_block_id: "5sdfd3-c811-41c5-93e6-ec1111f22201"
doc_id: 123456
type: normal_text
content: "{\\"alignment\\":\\"left\\",\\"direction\\":\\"ltr\\",\\"deltaFormat\\":[{\\"insert\\":\\"New text in cell\\"}]}"
) {
id
}
}

Is that what you need to do?


Looking forward to hearing from you 😀


Cheers,

Matias



Thanks @Matias.Monday .

It works for me 😀.


I’m getting error {\\"column_count\\": 11, \\"row_count\\": 10} Does it not support more than 5 rows/cols?

How can I manage?


Hello again @niraj83,


As of today, yes. The limit is 5 for rows and columns when creating the table via API. There is no way to add more than that when using this mutation.


Let me know if you have any other questions!


Cheers,

Matias


Reply