
# 验证票据(CAS3.0) - ValidateServiceCAS30
#### 功能介绍
应用验证票据，并获取用户属性信息。
#### 接口约束
null
#### URI
GET /api/v1/cas/p3/serviceValidate
表1Query参数 
| 参数      | 是否必选 | 参数类型   | 描述                               |
|:---|:---|:---|:---|
| service | 是    | String | 应用接受票据的地址，必须与应用CAS配置中的应用回调URL一致。 |
| ticket  | 是    | String | 票据，认证登录获取的Service Ticket。        |
| format  | 否    | String | 响应用户信息的格式，可选择XML和JSON。           |
#### 请求参数
无
#### 响应参数
**状态码：200**
请求成功。
无
#### 请求示例
查询CAS3.0接口验证票据，参数分别配置应用回调地址https://example.com及认证登录接口获取的认证票据ST-eYlKs8FrLCltwRwfm8AiwCxmQ8gAL...，使用JSON响应格式获取用户属性信息。
```
GET https://{domain_name}/api/v1/cas/p3/serviceValidate?service=https://example.com&ticket=ST-eYlKs8FrLCltwRwfm8AiwCxmQ8gAL...&format=JSON
```
#### 响应示例
**状态码：200**
请求成功。
- 示例 1
  ```
  <cas:serviceResponse xmlns:cas="http://www.yale.edu/tp/cas">
      <cas:authenticationSuccess>
          <cas:user>minghui</cas:user>
          <cas:attributes>
              <cas:authenticationDate>2020-02-11T09:28:14.987Z</cas:authenticationDate>
              <cas:longTermAuthenticationRequestTokenUsed>false</cas:longTermAuthenticationRequestTokenUsed>
              <cas:isFromNewLogin>true</cas:isFromNewLogin>
              <cas:date>2020-02-03T16:00:00.000Z</cas:date>
              <cas:birthday>2020-02-04T16:00:00.000Z</cas:birthday>
              <cas:createAt>2020-01-10T09:01:04.000Z</cas:createAt>
              <cas:disabledAt>null</cas:disabledAt>
              <cas:disabed>false</cas:disabed>
          </cas:attributes>
      </cas:authenticationSuccess>
  </cas:serviceResponse>
  ```
- 示例 2
  ```
  {
    "serviceResponse" : {
      "authenticationSuccess" : {
        "attributes" : {
          "date" : "2020-02-03T16:00:00.000Z",
          "birthday" : "2020-02-04T16:00:00.000Z",
          "createAt" : "2020-01-10T09:01:04.000Z",
          "disabed" : false,
          "authenticationDate" : "2020-02-11T06:43:30.588Z",
          "longTermAuthenticationRequestTokenUsed" : false,
          "isFromNewLogin" : true
        },
        "user" : "minghui"
      }
    }
  }
  ```
#### 状态码
| 状态码 | 描述    |
|:---|:---|
| 200 | 请求成功。 |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-oneaccess/ErrorCode.html)。
