> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# POST /titles/{titleId}/invites/server API

> Send Server Invite

# Send Server Invite

使用给定的连接字符串向 XBOX 用户发送邀请。

此 API 允许游戏服务器向 XBOX Live 用户发送邀请。请求正文包含一个连接字符串,受邀者使用该字符串加入服务器。连接字符串可以包含游戏服务器 IP,或指向用户所在会话的指针。邀请会发送到所有已注册的终结点,无论平台如何。

```http theme={null}
POST /titles/{titleId}/invites/server
```

## URI 参数

| 参数 | 位置 | 是否必需 | 类型 | 说明 |
| - | - | - | - | - |
| titleId | path | TRUE | integer | 发送请求所针对的游戏的 titleId。 |

## 请求标头

| 名称 | 是否必需 | 类型 | 说明 |
| - | - | - | - |
| Authorization | TRUE | integer | 调用方必须以 XBL 3.0 授权格式提供 XToken。例如,Authorization: XBL3.0 x=2553948354698;>encrypted token\<) |
| Content-Type | TRUE | string | ContentType 必须设置为 application/json |

## 请求正文

| 名称 | 是否必需 | 类型 | 说明 |
| - | - | - | - |
| invitedUsers | TRUE | string\[] | 邀请所发送到的用户的 XUID。XUID 表示为十进制整数。最多为 16 个 XUID。 |
| sender | TRUE | string | 代表其发送邀请的用户的 ID。 |
| connectionString | | string | 连接字符串是当邀请到达用户时传递给游戏的内容。连接字符串通常包含服务器 IP 之类的信息,以使被邀请的用户能够加入。如果连接字符串字段为空,则会以空连接字符串调用标题。连接字符串的长度限制为 512 个字符。 |
| platform | | [Platform](#platform) | |

## 响应

| 名称 | 类型 | 说明 |
| - | - | - |
| 204 No Content | | |
| 邀请已成功发送。 | | |
| 400 Bad Request | [ErrorResponse](#errorresponse) | 处理请求时发生错误。可能的错误代码:“RequestValidationError: The request validation has failed.”、“AuthorizationError: The caller is not allowed to access the resource. Too many requests.” |
| 其他状态代码 | [ThrottledEntity](#throttledentity) | 请求过多。标头 Retry-After: integer |

## 定义

* [ErrorResponse](#errorresponse)
* [Platform](#platform)
* [SendServerInviteRequest](#sendserverinviterequest)
* [ThrottledEntity](#throttledentity)

### ErrorResponse

| 名称 | 类型 | 说明 |
| - | - | - |
| debugMessage | string | 可用于调试的、人类可读的错误消息版本。 |
| errorCode | string | 错误代码枚举。 |

### Platform

| 名称 | 类型 | 说明 |
| - | - | - |
| Android | string | |
| IOS | string | |
| Nintendo | string | |
| PlayStation | string | |
| Scarlett | string | |
| Win32 | string | |
| WindowsOneCore | string | |
| XboxOne | string | |

### SendServerInviteRequest

| 名称 | 类型 | 说明 |
| - | - | - |
| connectionString | string | 连接字符串是当邀请到达用户时传递给游戏的内容。连接字符串通常包含服务器 IP 之类的信息,以使被邀请的用户能够加入。如果连接字符串字段为空,则会以空连接字符串调用标题。连接字符串的长度限制为 512 个字符。 |
| invitedUsers | string\[] | 邀请所发送到的用户的 XUID。XUID 表示为十进制整数。最多为 16 个 XUID。 |
| platform | [Platform](#platform) | |
| sender | string | 代表其发送邀请的用户的 ID。 |

### ThrottledEntity

| 名称 | 类型 | 说明 |
| - | - | - |
| currentRequests | string | 当前请求数——并发或速率。 |
| debugMessage | string | 可用于调试的、人类可读的限流消息版本。 |
| limitType | string | 限制类型,即并发或速率。 |
| maxRequests | string | 允许的最大请求数——并发或速率。 |
| periodInSeconds | string | 超出速率或并发限制时适用的以秒为单位的时段。 |
| version | string | 当前限流合约版本。 |


## Related topics

- [Invites](https://devdocs.xbox.com/services/xbox-services/multiplayer/mpa/concepts/live-mpa-invites.md)
- [Quickstart PlayFab REST API collection for Postman](https://devdocs.xbox.com/services/playfab/sdks/postman/postman-quickstart.md)
- [Exemple Windows Runner](https://devdocs.xbox.com/fr/services/playfab/multiplayer/servers/windows-runner-sample.md)
- [Início rápido da coleção da API REST do PlayFab para Postman](https://devdocs.xbox.com/pt-BR/services/playfab/sdks/postman/postman-quickstart.md)
- [适用于 Postman 的 PlayFab REST API 集合快速入门](https://devdocs.xbox.com/zh-CN/services/playfab/sdks/postman/postman-quickstart.md)
