Skip to content

Latest commit

 

History

History
83 lines (63 loc) · 2.07 KB

File metadata and controls

83 lines (63 loc) · 2.07 KB

Add federated server

Add a new federated server. The search-public-rooms.md endpoint will also return public rooms from this server.

URL Requires Auth HTTP Method
/api/v1/federation/addServerByUser yes POST

Payload

ArgumentExampleRequiredDescription
serverNamemy-server.rocket.chatRequiredThe public server name.

Example payload

{
  "serverName": "my-server.rocket.chat"
}

Example Call

curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \
     -H "X-User-Id: aobEdbYhXfu5hkeqG" \
     -X POST \
     -H "Content-type:application/json" \
     http://localhost:3000/api/v1/federation/addServerByUser \
    -d '{"serverName": "my-server.rocket.chat"}'

Example Result

Success

{
  "success": true
}

Error

Any of the following errors can occur on the endpoint.

  • Authorization: Requires an authentication token for the request to be made.
  • Already Added: Occurs when the server has already been added.
  • Invalid Server Name: This occurs when the server name is invalid.

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

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

{% endtab %}

{% tab title="Already Added" %}

{
    "success": false,
    "error": "already-a-default-server"
}

{% endtab %}

{% tab title="Invalid Server Name" %}

{
    "success": false,
    "error": "invalid-server-name"
}

{% endtab %} {% endtabs %}

Change Log

VersionDescription
6.0.0Added