Uploading a Case
curl -X POST https://api.digicust.com/upload/api/{customerId}/{projectId}/new \
-H "Content-Type: multipart/form-data" \
-H "Authorization: Bearer {access_token}" \
-F "files[]=@/path/to/file1.pdf" \
-F "files[]=@/path/to/file2.pdf" \
-F "classifications=[{\"fileName\":\"file1.pdf\",\"documentType\":\"invoice\"},{\"fileName\":\"file2.pdf\",\"documentType\":\"waybill\"}]" \
-F "executionStrategyId={executionStrategyId}" \
-F "reference={reference}" \
-F "documents=[{\"priority\":\"afterNormalization\",\"annotatedAggregated\":{}}]"
const file1 = new File(['content1'], 'filename1.pdf');
const file2 = new File(['content2'], 'filename2.pdf');
const files = [file1, file2];
const classifications = [
{ fileName: 'filename1.pdf', documentType: 'invoice' },
{ fileName: 'filename2.pdf', documentType: 'waybill' },
];
const executionStrategyId = 'strategyId123';
const reference = 'reference123';
const documents = [{ priority: 'afterNormalization', annotatedAggregated: {} }];
const uploadCase = async (customerId, projectId, files, classifications, executionStrategyId, reference, documents) => {
const url = `https://api.digicust.com/upload/api/${customerId}/${projectId}/new`;
const formData = new FormData();
files.forEach((file, index) => {
formData.append('files[]', file, classifications[index].fileName);
});
formData.append('classifications', JSON.stringify(classifications));
formData.append('executionStrategyId', executionStrategyId);
if (reference) formData.append('reference', reference);
if (documents) formData.append('documents', JSON.stringify(documents));
try {
const response = await fetch(url, {
method: 'POST',
headers: {
'Authorization': `Bearer ${accessToken}`
},
body: formData,
});
const data = await response.json();
console.log(data);
} catch (err) {
console.error('Error:', err);
}
};
uploadCase(
'customerId123',
'projectId123',
files,
classifications,
executionStrategyId,
reference,
documents
);
Endpoint: https://api.digicust.com/upload/api/{customerId}/{projectId}/new
https://api.digicust.com/upload/api/{customerId}/{projectId}/newHTTP Method
Headers
Header
Description
URL Parameters
Parameter
Type
Description
Request Body
Parameter
Type
Description
Property
Type
Description
Responses
Code
Description
Last updated