Method: projects.locations.knowledgeBases.documents.import

Create documents by importing data from external sources. Dialogflow supports up to 350 documents in each request. If you try to import more, Dialogflow will return an error.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

HTTP request

POST https://{endpoint}/v2beta1/{parent=projects/*/locations/*/knowledgeBases/*}/documents:import

Where {endpoint} is one of the supported service endpoints.

The URLs use gRPC Transcoding syntax.

Path parameters

Parameters
parent

string

Required. The knowledge base to import documents into. Format: projects/<Project ID>/locations/<Location ID>/knowledgeBases/<Knowledge Base ID>.

Authorization requires the following IAM permission on the specified resource parent:

  • dialogflow.documents.create

Request body

The request body contains data with the following structure:

JSON representation
{
  "documentTemplate": {
    object (ImportDocumentTemplate)
  },
  "importGcsCustomMetadata": boolean,

  // Union field source can be only one of the following:
  "gcsSource": {
    object (GcsSources)
  }
  // End of list of possible types for union field source.
}
Fields
documentTemplate

object (ImportDocumentTemplate)

Required. Document template used for importing all the documents.

importGcsCustomMetadata

boolean

Whether to import custom metadata from Google Cloud Storage. Only valid when the document source is Google Cloud Storage URI.

Union field source. Required. The source to use for importing documents.

If the source captures multiple objects, then multiple documents will be created, one corresponding to each object, and all of these documents will be created using the same document template.

Dialogflow supports up to 350 documents in each request. If you try to import more, Dialogflow will return an error. source can be only one of the following:

gcsSource

object (GcsSources)

Optional. The Google Cloud Storage location for the documents. The path can include a wildcard.

These URIs may have the forms gs://<bucket-name>/<object-name>. gs://<bucket-name>/<object-path>/*.<extension>.

Response body

If successful, the response body contains an instance of Operation.

Authorization scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/cloud-platform
  • https://www.googleapis.com/auth/dialogflow

For more information, see the Authentication Overview.