4
4
5
5
* <<workplace-search-initializing>>
6
6
* <<workplace-search-document-apis>>
7
+ * <<workplace-search-content-source-apis>>
7
8
* <<workplace-search-search-apis>>
8
9
* <<workplace-search-permissions-apis>>
9
10
* <<oauth-apps>>
@@ -100,6 +101,33 @@ workplace_search.index_documents(
100
101
}
101
102
---------------
102
103
104
+ ==== Get Document
105
+
106
+ To get a single document by ID use the `get_document()` method:
107
+
108
+ [source,python]
109
+ ---------------
110
+ # Request:
111
+ workplace_search.get_document(
112
+ content_source_id="<CONTENT_SOURCE_ID>",
113
+ document_id="<DOCUMENT_ID>"
114
+ )
115
+
116
+ # Response:
117
+ {
118
+ "id": "<DOCUMENT_ID>",
119
+ "source": "custom",
120
+ "content_source_id": "<CONTENT_SOURCE_ID>",
121
+ "last_updated": "2021-03-02T22:41:16+00:00",
122
+ "text_field": "some text value",
123
+ "number_field": 42,
124
+ "date_field": "2021-03-02T22:41:16+00:00",
125
+ "geolocation_field": "44.35,-68.21",
126
+ "_allow_permissions": ["perm1", "perm2"],
127
+ "_deny_permissions": ["perm3", "perm4"]
128
+ }
129
+ ---------------
130
+
103
131
==== Delete Documents
104
132
105
133
To remove documents from a custom content source use the `delete_documents()` method
@@ -111,7 +139,7 @@ and supply a list of document IDs to `body`:
111
139
workplace_search.delete_documents(
112
140
http_auth="<CONTENT_SOURCE_ACCESS_TOKEN>",
113
141
content_source_id="<CONTENT_SOURCE_ID>",
114
- body =[1234, 1235]
142
+ document_ids =[1234, 1235]
115
143
)
116
144
117
145
# Response:
@@ -129,6 +157,98 @@ workplace_search.delete_documents(
129
157
}
130
158
---------------
131
159
160
+ [[workplace-search-content-source-apis]]
161
+ === Content Source APIs
162
+
163
+ ==== Create Content Source
164
+
165
+ [source,python]
166
+ ---------------
167
+ workplace_search.create_content_source(
168
+ body={
169
+ "name": "Content Source Name",
170
+ "schema": {
171
+ "title": "text",
172
+ "body": "text",
173
+ "url": "text"
174
+ },
175
+ "display": {
176
+ "title_field": "title",
177
+ "url_field": "url",
178
+ "color": "#f00f00"
179
+ },
180
+ "is_searchable": True
181
+ }
182
+ )
183
+ ---------------
184
+
185
+ ==== Get Content Source
186
+
187
+ [source,python]
188
+ ---------------
189
+ workplace_search.get_content_source(
190
+ content_source_id="<CONTENT_SOURCE_ID>"
191
+ )
192
+ ---------------
193
+
194
+ ==== List Content Sources
195
+
196
+ [source,python]
197
+ ---------------
198
+ # Request:
199
+ workplace_search.list_content_sources()
200
+
201
+ # Response:
202
+ {
203
+ "meta": {
204
+ "page": {
205
+ "current": 1,
206
+ "total_pages": 1,
207
+ "total_results": 4,
208
+ "size": 25
209
+ }
210
+ },
211
+ "results": [
212
+ { <CONTENT SOURCE> },
213
+ ...
214
+ ]
215
+ }
216
+
217
+
218
+ ---------------
219
+
220
+ ==== Update Content Source
221
+
222
+ [source,python]
223
+ ---------------
224
+ workplace_search.put_content_source(
225
+ content_source_id="<CONTENT_SOURCE_ID>",
226
+ body={
227
+ "name": "Content Source Name",
228
+ "schema": {
229
+ "title": "text",
230
+ "body": "text",
231
+ "url": "text"
232
+ },
233
+ "display": {
234
+ "title_field": "title",
235
+ "url_field": "url",
236
+ "color": "#f00f00"
237
+ },
238
+ "is_searchable": True
239
+ }
240
+ )
241
+ ---------------
242
+
243
+ ==== Delete Content Source
244
+
245
+ [source,python]
246
+ ---------------
247
+ workplace_search.delete_content_source(
248
+ content_source_id="<CONTENT_SOURCE_ID>"
249
+ )
250
+ ---------------
251
+
132
252
[[workplace-search-search-apis]]
133
253
=== Search APIs
134
254
0 commit comments