Activity
We allow the option of allowing developers to push activity information for documents (VIEW, EDIT etc.) - that will be used for better ranking of documents for search.
Getting started with the activity endpoint
First note that, the activity endpoint needs to be called with a client API bearer token (as opposed to an indexing API bearer token for other endpoints). This is because, we expect activity to be provided server-to-server on a per-user basis (eg. when a user views a document from a custom datasource, you may report this view back to us from your server).
For pushing activity for any user from your organization, we need a Global client API token scoped to ACTIVITY.
To fetch a scoped client API token, please follow the instructions in the Authentication page for Client API.
Making your first request
Below is a sample activity request for a given user (who needs to be specified in the X-Glean-ActAs param).
We record 2 view events: One for https://example.com/doc1 and another for https://example.com/doc2. We specify the datasource in the params field (so it is correctly matched to the relevant document) and optionally, we also mention the duration of the view if available.