This page provides an overview of APIs related to type detection.
View type detection is a data flow accessible via a POST
call to [http|https]://[hostname]:[port]/[apiversion]/tenants/[tenantguid]/processing/typedetector
.
To request type detection, attach the body of the object to the request. Note: CSV
documents currently rely on hints (content-type header) as irregular CSV
files could otherwise be detected as plain text.
curl --location 'http://view.homedns.org:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/processing/typedetection' \
--header 'Content-Type: application/json' \
--header 'Authorization: ••••••' \
--data '{"menu": {
"id": "file",
"value": "File",
"popup": {
"menuitem": [
{"value": "New", "onclick": "CreateNewDoc()"},
{"value": "Open", "onclick": "OpenDoc()"},
{"value": "Close", "onclick": "CloseDoc()"}
]
}
}}'
import { ViewProcessorSdk } from "view-sdk";
const api = new ViewProcessorSdk(
"http://localhost:8000/", //endpoint
"<tenant-guid>", //tenant Id
"default" //access key
);
const typeDetection = async () => {
try {
const response = await api.processSdk.typeDetection({
menu: {
id: "file",
value: "File",
popup: {
menuitem: [
{ value: "New", onclick: "CreateNewDoc()" },
{ value: "Open", onclick: "OpenDoc()" },
{ value: "Close", onclick: "CloseDoc()" },
],
},
},
});
console.log(response);
} catch (error) {
console.error("Error type detection:", error);
}
};
typeDetection();
import view_sdk
from view_sdk import processor
sdk = view_sdk.configure( access_key="default",base_url="localhost", tenant_guid= "<tenant-guid>")
def typeDetection():
result = processor.TypeDetector.type_detection(menu= {
"id": "file",
"value": "File",
"popup": {
"menuitem": [
{"value": "New", "onclick": "CreateNewDoc()"},
{"value": "Open", "onclick": "OpenDoc()"},
{"value": "Close", "onclick": "CloseDoc()"}
]
}
})
print(result)
typeDetection()
The response structure is consistent across input data types.
{
"MimeType": "application/json",
"Extension": "json",
"Type": "Json"
}