Package google.developers.knowledge.v1alpha

Index

DeveloperKnowledge

The Developer Knowledge API provides programmatic access to Google's public developer documentation, enabling you to integrate this knowledge base into your own applications and workflows.

The API is designed to be the canonical source for machine-readable access to Google's developer documentation.

A typical use case is to first use DeveloperKnowledge.SearchDocumentChunks to find relevant page URIs based on a query, and then use DeveloperKnowledge.GetDocument or DeveloperKnowledge.BatchGetDocuments to fetch the full content of the top results.

All document content is provided in Markdown format.

BatchGetDocuments

rpc BatchGetDocuments(BatchGetDocumentsRequest) returns (BatchGetDocumentsResponse)

Retrieves multiple documents, each with its full Markdown content.

Authorization scopes

Requires one of the following OAuth scopes:

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

For more information, see the OAuth 2.0 Overview.

GetDocument

rpc GetDocument(GetDocumentRequest) returns (Document)

Retrieves a single document with its full Markdown content.

Authorization scopes

Requires one of the following OAuth scopes:

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

For more information, see the OAuth 2.0 Overview.

SearchDocumentChunks

rpc SearchDocumentChunks(SearchDocumentChunksRequest) returns (SearchDocumentChunksResponse)

Searches for developer knowledge across Google's developer documentation. Returns DocumentChunks based on the user's query. There may be many chunks from the same Document. To retrieve full documents, use DeveloperKnowledge.GetDocument or DeveloperKnowledge.BatchGetDocuments with the DocumentChunk.parent returned in the SearchDocumentChunksResponse.results.

Authorization scopes

Requires one of the following OAuth scopes:

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

For more information, see the OAuth 2.0 Overview.

BatchGetDocumentsRequest

Request message for DeveloperKnowledge.BatchGetDocuments.

Fields
names[]

string

Required. Specifies the names of the documents to retrieve. A maximum of 20 documents can be retrieved in a batch. The documents are returned in the same order as the names in the request.

Format: documents/{uri_without_scheme} Example: documents/docs.cloud.google.com/storage/docs/creating-buckets

view

DocumentView

Optional. Specifies the DocumentView of the document. If unspecified, DeveloperKnowledge.BatchGetDocuments defaults to DOCUMENT_VIEW_CONTENT.

BatchGetDocumentsResponse

Response message for DeveloperKnowledge.BatchGetDocuments.

Fields
documents[]

Document

Contains the documents requested.

Document

A Document represents a piece of content from the Developer Knowledge corpus.

Fields
name

string

Identifier. Contains the resource name of the document. Format: documents/{uri_without_scheme} Example: documents/docs.cloud.google.com/storage/docs/creating-buckets

uri

string

Output only. Provides the URI of the content, such as docs.cloud.google.com/storage/docs/creating-buckets.

content

string

Output only. Contains the full content of the document in Markdown format.

description

string

Output only. Provides a description of the document.

data_source

string

Output only. Specifies the data source of the document. Example data source: firebase.google.com

title

string

Output only. Provides the title of the document.

update_time

Timestamp

Output only. Represents the timestamp when the content or metadata of the document was last updated.

view

DocumentView

Output only. Specifies the DocumentView of the document.

DocumentChunk

A DocumentChunk represents a piece of content from a Document in the DeveloperKnowledge corpus. To fetch the entire document content, pass the parent to DeveloperKnowledge.GetDocument or DeveloperKnowledge.BatchGetDocuments.

Fields
parent

string

Output only. Contains the resource name of the document this chunk is from. Format: documents/{uri_without_scheme} Example: documents/docs.cloud.google.com/storage/docs/creating-buckets

id

string

Output only. Specifies the ID of this chunk within the document. The chunk ID is unique within a document, but not globally unique across documents. The chunk ID is not stable and may change over time.

content

string

Output only. Contains the content of the document chunk.

document

Document

Output only. Represents metadata about the Document this chunk is from. The DocumentView of this Document message will be set to DOCUMENT_VIEW_BASIC. It is included here for convenience so that clients do not need to call DeveloperKnowledge.GetDocument or DeveloperKnowledge.BatchGetDocuments if they only need the metadata fields. Otherwise, clients should use DeveloperKnowledge.GetDocument or DeveloperKnowledge.BatchGetDocuments to fetch the full document content.

DocumentView

Specifies which fields of the Document are included.

Enums
DOCUMENT_VIEW_UNSPECIFIED The default / unset value. See each API method for its default value if DocumentView is not specified.
DOCUMENT_VIEW_BASIC

Includes only the basic metadata fields: - name - uri - data_source - title - description - update_time - view

This is the default of view for DeveloperKnowledge.SearchDocumentChunks.

DOCUMENT_VIEW_FULL Includes all Document fields.
DOCUMENT_VIEW_CONTENT

Includes the DOCUMENT_VIEW_BASIC fields and the content field.

This is the default of view for DeveloperKnowledge.GetDocument and DeveloperKnowledge.BatchGetDocuments.

GetDocumentRequest

Request message for DeveloperKnowledge.GetDocument.

Fields
name

string

Required. Specifies the name of the document to retrieve. Format: documents/{uri_without_scheme} Example: documents/docs.cloud.google.com/storage/docs/creating-buckets

view

DocumentView

Optional. Specifies the DocumentView of the document. If unspecified, DeveloperKnowledge.GetDocument defaults to DOCUMENT_VIEW_CONTENT.

SearchDocumentChunksRequest

Request message for DeveloperKnowledge.SearchDocumentChunks.

Fields
query

string

Required. Provides the raw query string provided by the user, such as "How to create a Cloud Storage bucket?".

page_size

int32

Optional. Specifies the maximum number of results to return. The service may return fewer than this value.

If unspecified, at most 5 results will be returned.

The maximum value is 20; values above 20 will result in an INVALID_ARGUMENT error.

page_token

string

Optional. Contains a page token, received from a previous SearchDocumentChunks call. Provide this to retrieve the subsequent page.

SearchDocumentChunksResponse

Response message for DeveloperKnowledge.SearchDocumentChunks.

Fields
results[]

DocumentChunk

Contains the search results for the given query. Each DocumentChunk in this list contains a snippet of content relevant to the search query. Use the DocumentChunk.parent field of each result with DeveloperKnowledge.GetDocument or DeveloperKnowledge.BatchGetDocuments to retrieve the full document content.

next_page_token

string

Optional. Provides a token that can be sent as page_token to retrieve the next page. If this field is omitted, there are no subsequent pages.