Get Started
Indexing
- Get Started
- Guides
- Authentication
- Datasources
- Documents
- Debugging
- API Reference
- OpenAPI Spec
Client
- Get Started
- Guides
- Search
- Governance
- API Reference
- Activity
- Announcements
- Answers
- Authentication
- Chat
- Agents
- Collections
- Documents
- Insights
- Messages
- Pins
- Search
- Entities
- Shortcuts
- Summarize
- Verification
- Tools
- Governance
- OpenAPI Spec
Web SDK
- Get Started
- Components
- Guides
Actions
- Get Started
- Examples
Documents
Read documents by facets
Read the documents including metadata (does not include enhanced metadata via /documentmetadata
) macthing the given facet conditions.
POST
/
rest
/
api
/
v1
/
getdocumentsbyfacets
from glean import Glean, models
import os
with Glean(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as g_client:
res = g_client.client.documents.retrieve_by_facets(request={
"filter_sets": [
{
"filters": [
{
"field_name": "type",
"values": [
{
"value": "Spreadsheet",
"relation_type": models.RelationType.EQUALS,
},
{
"value": "Presentation",
"relation_type": models.RelationType.EQUALS,
},
],
},
],
},
{
"filters": [
{
"field_name": "type",
"values": [
{
"value": "Spreadsheet",
"relation_type": models.RelationType.EQUALS,
},
{
"value": "Presentation",
"relation_type": models.RelationType.EQUALS,
},
],
},
],
},
],
})
# Handle response
print(res)
{
"documents": [
{
"id": "<string>",
"datasource": "<string>",
"connectorType": "API_CRAWL",
"docType": "<string>",
"content": {
"fullTextList": [
"<string>"
]
},
"containerDocument": {},
"parentDocument": {},
"title": "<string>",
"url": "<string>",
"metadata": {
"container": "container",
"parentId": "JIRA_EN-1337",
"createTime": "2000-01-23T04:56:07.000Z",
"datasource": "datasource",
"author": {
"name": "name"
},
"documentId": "documentId",
"updateTime": "2000-01-23T04:56:07.000Z",
"mimeType": "mimeType",
"objectType": "Feature Request",
"components": [
"Backend",
"Networking"
],
"status": [
"Done"
],
"customData": {
"someCustomField": "someCustomValue"
}
},
"sections": [
{
"title": "<string>",
"url": "<string>"
}
]
}
],
"hasMoreResults": true,
"cursor": "<string>"
}
Authorizations
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Body
application/json
Information about facet conditions for documents to be retrieved.
The body is of type object
.
Response
200
application/json
OK
The response is of type object
.
from glean import Glean, models
import os
with Glean(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as g_client:
res = g_client.client.documents.retrieve_by_facets(request={
"filter_sets": [
{
"filters": [
{
"field_name": "type",
"values": [
{
"value": "Spreadsheet",
"relation_type": models.RelationType.EQUALS,
},
{
"value": "Presentation",
"relation_type": models.RelationType.EQUALS,
},
],
},
],
},
{
"filters": [
{
"field_name": "type",
"values": [
{
"value": "Spreadsheet",
"relation_type": models.RelationType.EQUALS,
},
{
"value": "Presentation",
"relation_type": models.RelationType.EQUALS,
},
],
},
],
},
],
})
# Handle response
print(res)
{
"documents": [
{
"id": "<string>",
"datasource": "<string>",
"connectorType": "API_CRAWL",
"docType": "<string>",
"content": {
"fullTextList": [
"<string>"
]
},
"containerDocument": {},
"parentDocument": {},
"title": "<string>",
"url": "<string>",
"metadata": {
"container": "container",
"parentId": "JIRA_EN-1337",
"createTime": "2000-01-23T04:56:07.000Z",
"datasource": "datasource",
"author": {
"name": "name"
},
"documentId": "documentId",
"updateTime": "2000-01-23T04:56:07.000Z",
"mimeType": "mimeType",
"objectType": "Feature Request",
"components": [
"Backend",
"Networking"
],
"status": [
"Done"
],
"customData": {
"someCustomField": "someCustomValue"
}
},
"sections": [
{
"title": "<string>",
"url": "<string>"
}
]
}
],
"hasMoreResults": true,
"cursor": "<string>"
}
Assistant
Responses are generated using AI and may contain mistakes.