// Before running the sample:
// - Enable the API at:
// https://console.developers.google.com/apis/api/documentai.googleapis.com
// - Login into gcloud by running:
// `$ gcloud auth application-default login`
// - Install the npm module by running:
// `$ npm install googleapis`
const {google} = require('googleapis');
const documentai = google.documentai('v1beta3');
async function main() {
const auth = new google.auth.GoogleAuth({
// Scopes can be specified either as an array or as a single, space-delimited string.
scopes: ['https://www.googleapis.com/auth/cloud-platform'],
});
// Acquire an auth client, and bind it to all future calls
const authClient = await auth.getClient();
google.options({auth: authClient});
// Do the magic
const res =
await documentai.projects.locations.processors.processorVersions.batchProcess(
{
// Required. The resource name of Processor or ProcessorVersion. Format: projects/{project\}/locations/{location\}/processors/{processor\}, or projects/{project\}/locations/{location\}/processors/{processor\}/processorVersions/{processorVersion\}
name: 'projects/my-project/locations/my-location/processors/my-processor/processorVersions/my-processorVersion',
// Request body metadata
requestBody: {
// request body parameters
// {
// "documentOutputConfig": {},
// "inputConfigs": [],
// "inputDocuments": {},
// "outputConfig": {},
// "skipHumanReview": false
// }
},
}
);
console.log(res.data);
// Example response
// {
// "done": false,
// "error": {},
// "metadata": {},
// "name": "my_name",
// "response": {}
// }
}
main().catch(e => {
console.error(e);
throw e;
});
// Before running the sample:
// - Enable the API at:
// https://console.developers.google.com/apis/api/documentai.googleapis.com
// - Login into gcloud by running:
// `$ gcloud auth application-default login`
// - Install the npm module by running:
// `$ npm install googleapis`
const {google} = require('googleapis');
const documentai = google.documentai('v1beta2');
async function main() {
const auth = new google.auth.GoogleAuth({
// Scopes can be specified either as an array or as a single, space-delimited string.
scopes: ['https://www.googleapis.com/auth/cloud-platform'],
});
// Acquire an auth client, and bind it to all future calls
const authClient = await auth.getClient();
google.options({auth: authClient});
// Do the magic
const res = await documentai.projects.locations.documents.batchProcess({
// Target project and location to make a call. Format: `projects/{project-id\}/locations/{location-id\}`. If no location is specified, a region will be chosen automatically.
parent: 'projects/my-project/locations/my-location',
// Request body metadata
requestBody: {
// request body parameters
// {
// "requests": []
// }
},
});
console.log(res.data);
// Example response
// {
// "done": false,
// "error": {},
// "metadata": {},
// "name": "my_name",
// "response": {}
// }
}
main().catch(e => {
console.error(e);
throw e;
});
// Before running the sample:
// - Enable the API at:
// https://console.developers.google.com/apis/api/documentai.googleapis.com
// - Login into gcloud by running:
// `$ gcloud auth application-default login`
// - Install the npm module by running:
// `$ npm install googleapis`
const {google} = require('googleapis');
const documentai = google.documentai('v1beta2');
async function main() {
const auth = new google.auth.GoogleAuth({
// Scopes can be specified either as an array or as a single, space-delimited string.
scopes: ['https://www.googleapis.com/auth/cloud-platform'],
});
// Acquire an auth client, and bind it to all future calls
const authClient = await auth.getClient();
google.options({auth: authClient});
// Do the magic
const res = await documentai.projects.locations.documents.process({
// Target project and location to make a call. Format: `projects/{project-id\}/locations/{location-id\}`. If no location is specified, a region will be chosen automatically. This field is only populated when used in ProcessDocument method.
parent: 'projects/my-project/locations/my-location',
// Request body metadata
requestBody: {
// request body parameters
// {
// "automlParams": {},
// "documentType": "my_documentType",
// "entityExtractionParams": {},
// "formExtractionParams": {},
// "inputConfig": {},
// "ocrParams": {},
// "outputConfig": {},
// "parent": "my_parent",
// "tableExtractionParams": {}
// }
},
});
console.log(res.data);
// Example response
// {
// "content": "my_content",
// "entities": [],
// "entityRelations": [],
// "error": {},
// "labels": [],
// "mimeType": "my_mimeType",
// "pages": [],
// "revisions": [],
// "shardInfo": {},
// "text": "my_text",
// "textChanges": [],
// "textStyles": [],
// "uri": "my_uri"
// }
}
main().catch(e => {
console.error(e);
throw e;
});
// Before running the sample:
// - Enable the API at:
// https://console.developers.google.com/apis/api/documentai.googleapis.com
// - Login into gcloud by running:
// `$ gcloud auth application-default login`
// - Install the npm module by running:
// `$ npm install googleapis`
const {google} = require('googleapis');
const documentai = google.documentai('v1beta2');
async function main() {
const auth = new google.auth.GoogleAuth({
// Scopes can be specified either as an array or as a single, space-delimited string.
scopes: ['https://www.googleapis.com/auth/cloud-platform'],
});
// Acquire an auth client, and bind it to all future calls
const authClient = await auth.getClient();
google.options({auth: authClient});
// Do the magic
const res = await documentai.projects.documents.batchProcess({
// Target project and location to make a call. Format: `projects/{project-id\}/locations/{location-id\}`. If no location is specified, a region will be chosen automatically.
parent: 'projects/my-project',
// Request body metadata
requestBody: {
// request body parameters
// {
// "requests": []
// }
},
});
console.log(res.data);
// Example response
// {
// "done": false,
// "error": {},
// "metadata": {},
// "name": "my_name",
// "response": {}
// }
}
main().catch(e => {
console.error(e);
throw e;
});
// Before running the sample:
// - Enable the API at:
// https://console.developers.google.com/apis/api/documentai.googleapis.com
// - Login into gcloud by running:
// `$ gcloud auth application-default login`
// - Install the npm module by running:
// `$ npm install googleapis`
const {google} = require('googleapis');
const documentai = google.documentai('v1beta3');
async function main() {
const auth = new google.auth.GoogleAuth({
// Scopes can be specified either as an array or as a single, space-delimited string.
scopes: ['https://www.googleapis.com/auth/cloud-platform'],
});
// Acquire an auth client, and bind it to all future calls
const authClient = await auth.getClient();
google.options({auth: authClient});
// Do the magic
const res =
await documentai.projects.locations.processors.processorVersions.process({
// Required. The resource name of the Processor or ProcessorVersion to use for processing. If a Processor is specified, the server will use its default version. Format: projects/{project\}/locations/{location\}/processors/{processor\}, or projects/{project\}/locations/{location\}/processors/{processor\}/processorVersions/{processorVersion\}
name: 'projects/my-project/locations/my-location/processors/my-processor/processorVersions/my-processorVersion',
// Request body metadata
requestBody: {
// request body parameters
// {
// "document": {},
// "inlineDocument": {},
// "rawDocument": {},
// "skipHumanReview": false
// }
},
});
console.log(res.data);
// Example response
// {
// "document": {},
// "humanReviewOperation": "my_humanReviewOperation",
// "humanReviewStatus": {}
// }
}
main().catch(e => {
console.error(e);
throw e;
});