Skip to content
This repository has been archived by the owner on Jun 27, 2024. It is now read-only.

Latest commit

 

History

History
76 lines (62 loc) · 2.43 KB

autocomplete-private-channel.md

File metadata and controls

76 lines (62 loc) · 2.43 KB

Autocomplete Room Name for Private and Public Rooms

List the public and private rooms whose names match a given string, excluding discussions, DMs, and omnichannel rooms. The endpoint is valuable when performing search operations. It returns only rooms that the user belongs to.

HTTP MethodURLRequires Auth
GET/api/v1/rooms.autocomplete.channelAndPrivateyes

Query Parameters

KeyExample ValueDescription
selector*{"name":"ran"}The term to be completed. It only applies to room name.

Example Call

{% code overflow="wrap" %}

curl --location --request GET 'http://localhost:3000/api/v1/rooms.autocomplete.channelAndPrivate?selector=[]\
--header 'X-Auth-Token: myauth-token' \
--header 'X-User-Id: myuser-name'

{% endcode %}

Example Response

Success

{
    "items": [
        {
            "_id": "664f0d525df46832f75b1860",
            "fname": "rancher",
            "name": "rancher",
            "t": "p"
        },
        {
            "_id": "6630e94ad2226209149c67e2",
            "fname": "random",
            "name": "random",
            "t": "c"
        },
        {
            "_id": "664f148f5df46832f75b18b2",
            "fname": "ranmowe",
            "name": "ranmowe",
            "t": "p"
        }
    ],
    "success": true
}

Errors

The following errors can occur:

  • Authorization: Requires an authentication token for the request to be made.
  • Selector Param: Requires selector param for the request to be made.

{% tabs %} {% tab title="Authorization" %}

{
    "status": "error",
    "message": "You must be logged in to do this."
}

{% endtab %}

{% tab title="Selector Param" %}

{
    "success": false,
    "error": "The 'selector' param is required"
}

{% endtab %} {% endtabs %}