This document defines an autocomplete search endpoint and endpoint discovery mechanism for [[ActivityPub]] API clients.
Social software clients often include a text composition interface. When the user wants to mention another actor, they can type a few letters of the actor's name (or other properties), and get a popup selection of matching actors.
Some social software clients also use typeahead dropdown elements to choose actors in other contexts besides tagging.
Actor autocomplete search is useful in situations when:
This specification is for the following user stories:
An [[[ActivityPub]]] API client operating on behalf of an actor can use the actor object to discover the autocomplete search
endpoint. The endpoints property of the actor includes
properties for useful API endpoints. The actorAutocomplete property defines a
[[[RFC6570]]] for an endpoint with the behaviour defined below in Endpoint. The URI
template takes a single argument, q, the text typed so far.
The endpoint URI template takes a single parameter, q, representing the text typed so far. The
endpoint SHOULD require authentication and SHOULD support bearer tokens as in [[RFC6750]].
The endpoint should return an [[[activitystreams-core]]] Collection of actor objects that match the search parameter. The collection may use collection paging.
The pool of actors searched is server-defined. The actors found can come from the actor's followers or following collections, from the local server user directory, from a global user directory, or any other source.
The matching algorithm is server-defined. The match can be on different properties of the actor, such as
preferredUsername or name, or on other properties. The match can be exact, or by prefix,
or fuzzy matching, or another matching algorithm.
The sorting order is descending by relevance as defined by the server for autocompletion. The first items in the collection are the most relevant to the user's needs; later items are less relevant. The actor relevance value is not represented by a property in the results.
All objects returned in the search results MUST be ActivityPub actor objects, with the required properties of ActivityPub actors.
If there are no actors found that match the query parameter, the response MUST still be returned, with an empty
Collection. The HTTP status code MUST be 200.
In case of an error, when the endpoint cannot fulfill the request, it MUST return an [[[RFC7807]]] result.
This specification defines a custom problem detail type for a specific error situation. Many typeahead search systems require a minimum number of characters in the query parameter to execute a search, to prevent overly broad results. This error type is used if the minimum number of characters is not provided.
The context URI for terms defined in this document is
https://swicg.github.io/activitypub-api/autocomplete. The namespace for the terms is
https://swicg.github.io/activitypub-api/autocomplete#.
The following extension term is defined in this document.
| URI: |
https://swicg.github.io/activitypub-api/autocomplete#actorAutocompleteautocomplete:actorAutocompleteactorAutocomplete
|
| Notes: | Defines an endpoint for autocomplete search for actors. Discoverable as defined in Discovery. An endpoint so described must behave as in Endpoint. |
| Domain: | Object (an ActivityPub Actor
endpoints object)
|
| Range: | xsd:anyURI |
| Functional: | true |
This is required for specifications that contain normative material.