为企业创建注册令牌。 此方法是 EnrollmentTokensService 的一部分。
请求
HTTP 请求
POST https://www.googleapis.com/androidenterprise/v1/enterprises/enterpriseId/enrollmentTokens
参数
| 参数名称 | 值 | 说明 | 
|---|---|---|
| 路径参数 | ||
| enterpriseId | string | 企业的 ID。 | 
授权
此请求需要获得以下范围的授权:
| 范围 | 
|---|
| https://www.googleapis.com/auth/androidenterprise | 
如需了解详情,请参阅身份验证和授权页面。
请求正文
在请求正文中,请按以下结构提供数据:
{
  "kind": "androidenterprise#enrollmentToken",
  "token": string,
  "enrollmentTokenType": string,
  "duration": {
    "seconds": long,
    "nanos": integer
  },
  "googleAuthenticationOptions": {
    "authenticationRequirement": string,
    "requiredAccountEmail": string
  }
}| 属性名称 | 值 | 说明 | 备注 | 
|---|---|---|---|
| kind | string | ||
| token | string | 传递给设备并授权设备注册的令牌值。此字段是服务器生成的只读字段。 | |
| enrollmentTokenType | string | [必需] 注册令牌的类型。 可接受的值包括: 
 | |
| duration | nested object | [可选] 注册令牌的有效时长,范围从 1 分钟到 Durations.MAX_VALUE(大约 1 万年)。如果未指定,则默认时长为 1 小时。 | |
| duration.seconds | long | 时间段的带符号秒数。 | |
| googleAuthenticationOptions | nested object | [可选] 提供注册期间与 Google 身份验证相关的选项。 | |
| googleAuthenticationOptions.authenticationRequirement | string | [可选] 指定用户在注册期间是否应通过 Google 进行身份验证。如果提供,则在设备通过此令牌注册时,替换企业资源的 GoogleAuthenticationSettings。可接受的值: 
 | |
| googleAuthenticationOptions.requiredAccountEmail | string | [可选] 指定用户在注册期间必须使用的受管理的 Google 账号。如果设置了此字段,则必须将 AuthenticationRequirement设置为REQUIRED。 | 
响应
如果成功,此方法将返回采用以下结构的响应正文:
{
  "kind": "androidenterprise#enrollmentToken",
  "token": string,
  "enrollmentTokenType": string,
  "duration": {
    "seconds": long,
    "nanos": integer
  },
  "googleAuthenticationOptions": {
    "authenticationRequirement": string,
    "requiredAccountEmail": string
  }
}| 属性名称 | 值 | 说明 | 备注 | 
|---|---|---|---|
| kind | string | ||
| token | string | 传递给设备并授权设备注册的令牌值。此字段是服务器生成的只读字段。 | |
| enrollmentTokenType | string | [必需] 注册令牌的类型。 可接受的值包括: 
 | |
| duration | nested object | [可选] 注册令牌的有效时长,范围从 1 分钟到 Durations.MAX_VALUE(大约 1 万年)。如果未指定,则默认时长为 1 小时。 | |
| duration.seconds | long | 时间段的带符号秒数。 | |
| googleAuthenticationOptions | nested object | [可选] 提供注册期间与 Google 身份验证相关的选项。 | |
| googleAuthenticationOptions.authenticationRequirement | string | [可选] 指定用户在注册期间是否应通过 Google 进行身份验证。如果指定了此设置,则对于使用此令牌注册的设备,系统会忽略为企业资源指定的 GoogleAuthenticationSettings。可接受的值: 
 | |
| googleAuthenticationOptions.requiredAccountEmail | string | [可选] 指定用户在注册期间必须使用的受管理的 Google 账号。 AuthenticationRequirement必须设置为REQUIRED |