REST APIs FAQ
Our REST APIs FAQ provides answers to common questions about implementing and using Glean's APIs. For detailed implementation guidance, see our developer documentation.
When using the /indexdocument and /bulkindexdocuments endpoints, documents are added to a processing queue and are not indexed immediately. To expedite document indexing:
- Use the /processalldocuments endpoint to schedule immediate processing
- Verify document status using the get document information endpoint
- Check permissions with the check document access endpoint if the document is indexed but not appearing in results
You have several options for document deletion:
- Use the /deletedocument endpoint for individual documents
- Use /bulkindexdocuments to remove documents not present in the upload
- To delete all documents, use /bulkindexdocuments with an empty documents array and set disableStaleDocumentDeletionCheck to true
We maintain a public GitHub repository with example implementations for our APIs. You can find these examples in our indexing-api-connectors repository.
The Results Display options are not shown until object definitions are created for the connector. This is because you can customize the results display based on the object type. For more information on setting up object definitions, please refer to our documentation on custom properties.
When a document contains a custom property value that violates its declared type (for example, a non-string element in a TEXTLIST), the API returns an HTTP 400 response. The response body identifies the specific document and offending value so you can locate the problem:
Document rightanswers-doc-001 has invalid value at index 2
for custom property Attributes: expected String, got java.lang.Integer
To resolve this:
- Check the document ID and property name in the error message to find the record in your upload payload.
- For list-type properties, use the list index to locate the exact element that has the wrong type.
- Correct the value so it matches the declared property type, then re-upload.
- If the document ID shows as
Document (id unspecified), ensure every document in your payload includes a valididfield.
Validation stops at the first invalid property. After fixing one error, re-upload to check for additional issues. For more details, see the custom property validation errors section of the troubleshooting guide.
Glean Platform API endpoints return 405 Method Not Allowed when called with an unsupported HTTP method. These responses include an Allow header listing the supported methods, and the response body uses the problem detail code method_not_allowed.
A 404 resource_not_found response means the endpoint path itself is not valid. A 405 method_not_allowed response means the endpoint exists but the HTTP method you used is not supported.
For example, sending a GET request to a POST-only endpoint:
curl -i -X GET https://<instance>/api/search \
-H "Authorization: Bearer <token>"
Returns:
HTTP/1.1 405 Method Not Allowed
Allow: POST
Content-Type: application/problem+json
{
"code": "method_not_allowed"
}
If you receive a 405 response, check the Allow header in the response to see which HTTP methods are supported, then update your request accordingly.