|
3 | 3 | The Glean Java SDK provides convenient access to the Glean REST API for Java 8+. It includes POJOs for all API models, fluent builders for requests, and supports both synchronous and asynchronous execution using standard HTTP clients. |
4 | 4 | <!-- No Summary [summary] --> |
5 | 5 |
|
| 6 | +## Unified SDK Architecture |
| 7 | + |
| 8 | +This SDK combines both the Client and Indexing API namespaces into a single unified package: |
| 9 | + |
| 10 | +- **Client API**: Used for search, retrieval, and end-user interactions with Glean content |
| 11 | +- **Indexing API**: Used for indexing content, permissions, and other administrative operations |
| 12 | + |
| 13 | +Each namespace has its own authentication requirements and access patterns. While they serve different purposes, having them in a single SDK provides a consistent developer experience across all Glean API interactions. |
| 14 | + |
| 15 | +```java |
| 16 | +// Example of accessing Client namespace |
| 17 | +Glean glean = Glean.builder() |
| 18 | + .bearerAuth("client-token") |
| 19 | + .build(); |
| 20 | +glean.client().search().query() |
| 21 | + .searchRequest(SearchRequest.builder().query("search term").build()) |
| 22 | + .call(); |
| 23 | + |
| 24 | +// Example of accessing Indexing namespace |
| 25 | +Glean glean = Glean.builder() |
| 26 | + .bearerAuth("indexing-token") |
| 27 | + .build(); |
| 28 | +glean.indexing().documents().index() |
| 29 | + .request(DocumentBulkIndexRequest.builder() /* document data */ .build()) |
| 30 | + .call(); |
| 31 | +``` |
| 32 | + |
| 33 | +Remember that each namespace requires its own authentication token type as described in the [Authentication Methods](#authentication-methods) section. |
| 34 | + |
6 | 35 | <!-- Start Table of Contents [toc] --> |
7 | 36 | ## Table of Contents |
8 | 37 | <!-- $toc-max-depth=2 --> |
@@ -188,6 +217,35 @@ public class Application { |
188 | 217 | ``` |
189 | 218 | <!-- End Authentication [security] --> |
190 | 219 |
|
| 220 | +### Authentication Methods |
| 221 | + |
| 222 | +Glean supports different authentication methods depending on which API namespace you're using: |
| 223 | + |
| 224 | +#### Client Namespace |
| 225 | + |
| 226 | +The Client namespace supports two authentication methods: |
| 227 | + |
| 228 | +1. **Manually Provisioned API Tokens** |
| 229 | + - Can be created by an Admin or a user with the API Token Creator role |
| 230 | + - Used for server-to-server integrations |
| 231 | + |
| 232 | +2. **OAuth** |
| 233 | + - Requires OAuth setup to be completed by an Admin |
| 234 | + - Used for user-based authentication flows |
| 235 | + |
| 236 | +#### Indexing Namespace |
| 237 | + |
| 238 | +The Indexing namespace supports only one authentication method: |
| 239 | + |
| 240 | +1. **Manually Provisioned API Tokens** |
| 241 | + - Can be created by an Admin or a user with the API Token Creator role |
| 242 | + - Used for secure document indexing operations |
| 243 | + |
| 244 | +> [!IMPORTANT] |
| 245 | +> Client tokens **will not work** for Indexing operations, and Indexing tokens **will not work** for Client operations. You must use the appropriate token type for the namespace you're accessing. |
| 246 | +
|
| 247 | +For more information on obtaining the appropriate token type, please contact your Glean administrator. |
| 248 | + |
191 | 249 | <!-- Start Available Resources and Operations [operations] --> |
192 | 250 | ## Available Resources and Operations |
193 | 251 |
|
|
0 commit comments