Report user activity that occurs on indexed documents such as viewing or editing. This signal improves search quality.
package hello.world;
import com.glean.api_client.glean_api_client.Glean;
import com.glean.api_client.glean_api_client.models.components.*;
import com.glean.api_client.glean_api_client.models.operations.ActivityResponse;
import java.lang.Exception;
import java.time.OffsetDateTime;
import java.util.List;
public class Application {
public static void main(String[] args) throws Exception {
Glean sdk = Glean.builder()
.apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
.build();
Activity req = Activity.builder()
.events(List.of(
ActivityEvent.builder()
.action(ActivityEventAction.HISTORICAL_VIEW)
.timestamp(OffsetDateTime.parse("2000-01-23T04:56:07.000Z"))
.url("https://example.com/")
.build(),
ActivityEvent.builder()
.action(ActivityEventAction.SEARCH)
.timestamp(OffsetDateTime.parse("2000-01-23T04:56:07.000Z"))
.url("https://example.com/search?q=query")
.params(ActivityEventParams.builder()
.query("query")
.build())
.build(),
ActivityEvent.builder()
.action(ActivityEventAction.VIEW)
.timestamp(OffsetDateTime.parse("2000-01-23T04:56:07.000Z"))
.url("https://example.com/")
.params(ActivityEventParams.builder()
.duration(20L)
.referrer("https://example.com/document")
.build())
.build()))
.build();
ActivityResponse res = sdk.client().activity().report()
.request(req)
.call();
// handle response
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
request |
Activity | ✔️ | The request object to use for the request. |
| Error Type | Status Code | Content Type |
|---|---|---|
| models/errors/APIException | 4XX, 5XX | */* |
Report events that happen to results within a Glean client UI, such as search result views and clicks. This signal improves search quality.
package hello.world;
import com.glean.api_client.glean_api_client.Glean;
import com.glean.api_client.glean_api_client.models.components.Event;
import com.glean.api_client.glean_api_client.models.components.Feedback;
import com.glean.api_client.glean_api_client.models.operations.FeedbackResponse;
import java.lang.Exception;
import java.util.List;
public class Application {
public static void main(String[] args) throws Exception {
Glean sdk = Glean.builder()
.apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
.build();
FeedbackResponse res = sdk.client().activity().feedback()
.feedback1(Feedback.builder()
.trackingTokens(List.of(
"trackingTokens"))
.event(Event.VIEW)
.build())
.call();
// handle response
}
}| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
feedbackQueryParameter |
Optional<String> | ➖ | A URL encoded versions of Feedback. This is useful for requests. | |
feedback1 |
Optional<Feedback> | ➖ | N/A | { "trackingTokens": [ "trackingTokens" ], "event": "VIEW" } |
| Error Type | Status Code | Content Type |
|---|---|---|
| models/errors/APIException | 4XX, 5XX | */* |