Question:
Can you upload documents with table field data when using the Rest API?
Answer:
It is possible to upload documents using the Rest API where you can include data for table fields.
Using our Postman collection, for example, this can be done using either XML or JSON.
JSON Example:
Rest Call Used: {{ServerUrl}}/{{Platform}}/FileCabinets/{{FileCabinetId}}/Documents
JSON Body example;
{
"Fields": [
{
"FieldName": "COMPANY",
"Item": "Company 1",
"ItemElementName": "String"
},
{
"FieldName": "TABLE_FIELD",
"ReadOnly": false,
"SystemField": false,
"ItemElementName": "Table",
"PointAndShootInfo": null,
"IsAutoNumber": false,
"IsNull": false,
"Item": {
"$type": "DocumentIndexFieldTable",
"Row": [
{
"ColumnValue": [
{
"FieldName": "TABLE_NAME",
"ReadOnly": false,
"SystemField": false,
"ItemElementName": "String",
"PointAndShootInfo": null,
"IsAutoNumber": false,
"IsNull": false,
"Item": "test",
"FieldValue": "test"
}
]
}
]
}
}
]
}
XML Example:
Rest Call Used: {{ServerUrl}}/{{Platform}}/FileCabinets/{{FileCabinetId}}/Documents
XML Body example;
Rest Call Used: {{ServerUrl}}/{{Platform}}/FileCabinets/{{FileCabinetId}}/Documents
XML Body example;
<Document xmlns="http://dev.docuware.com/schema/public/services/platform" Id="1">
<Fields>
<Field FieldName="COMPANY">
<String>Peters Engineering</String>
</Field>
<Field FieldName="DATETIME">
<String>10/6/2021</String>
</Field>
<Field FieldName="TABLE_FIELD">
<Table>
<Row>
<ColumnValue FieldName="TABLE_NAME">
<String>Test</String>
</ColumnValue>
</Row>
</Table>
</Field>
</Fields>
</Document>
To convert these calls into other languages such as C#, see KBA-36429.
KBA is applicable for both Cloud and On-premise Organizations.