> ## 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

> Send Invite

# Send Invite

向 XBOX Live 用户发送邀请。

此 API 允许游戏客户端针对特定标题向 XBOX Live 用户发送邀请。邀请会发送到所有已注册的终结点,无论平台如何。

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

## 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。 |
| 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)
* [SendInviteRequest](#sendinviterequest)
* [ThrottledEntity](#throttledentity)

### ErrorResponse

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

### Platform

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

### SendInviteRequest

如果请求中未设置平台,则邀请将允许收件人在该游戏可玩的任何平台上加入。否则,只包含所列的平台。

**注意:** 例外情况是,如果 Scarlett 未配置为平台,则指定 XboxOne 的邀请也会发送到 Scarlett 设备。

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

### ThrottledEntity

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


## Related topics

- [TitleId Element (MicrosoftGame.config)](https://devdocs.xbox.com/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-titleid.md)
- [TitleId 요소(MicrosoftGame.config)](https://devdocs.xbox.com/ko/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-titleid.md)
- [TitleId 元素 (MicrosoftGame.config)](https://devdocs.xbox.com/zh-CN/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-titleid.md)
- [Élément MicrosoftGame.config - TitleId](https://devdocs.xbox.com/fr/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-titleid.md)
- [TitleId 要素 (MicrosoftGame.config)](https://devdocs.xbox.com/ja-jp/reference/system/microsoftgameconfig/elements/microsoftgameconfig-element-titleid.md)
