# 获取自定义注册用户信息

### 接口URL

```
http://api.polyv.net/live/v2/app/get-custom-user
```

### 接口说明

```
1、接口用于获取用户信息
2、接口支持https
```

### 支持格式

```
JSON
```

### 请求方式

```
GET
```

### 请求数限制

```
TRUE
```

### 请求参数

| 参数名       | 必选 | 类型     | 说明                                                                                                                                                                                                        |
| --------- | -- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| appId     | 是  | string | 调用接口需要的APPID                                                                                                                                                                                              |
| timestamp | 是  | long   | 13位当前时间戳                                                                                                                                                                                                  |
| sign      | 是  | String | 签名，为32位大写的MD5值,`生成签名的appSecret密钥作为通信数据安全的关键信息，严禁保存在客户端直接使用，所有API都必须通过客户自己服务器中转调用POLYV服务器获取响应数据`【详见[签名生成规则](https://git.polyv.net/help-center/document-center/-/blob/master/live/api/buildSign/README.md)】 |
| email     | 是  | string | 邮箱地址                                                                                                                                                                                                      |

### 响应成功JSON示例：

```json
{
"code": 200,
"status": "success",
"message": "",
"data": {
"name": "alexydz",
"mobile": "15903079988",
"company": "xxxx company",
"userId": "ecf5ee31fb",
"email": "1111111@ruizaiyun.com"
}
}
```

### 响应字段说明

| 参数名          | 说明                                     |
| ------------ | -------------------------------------- |
| code         | 状态码,成功为200，签名失败为403，参数错误为400，服务端错误为500 |
| status       | 成功为success,错误时为error                   |
| message      | 成功为""，错误时为错误描述信息                       |
| data.userId  | 用户ID                                   |
| data.email   | 用户账号邮箱地址                               |
| data.name    | 用户名称                                   |
| data.company | 用户所属机构                                 |
| data.mobile  | 用户的手机号码                                |

### 响应失败JSON示例：

参数错误

```json
{
    "code": 400,
    "status": "error",
    "message": "param validate error",
    "data": 400
}
```

未输入appId

```json
{
    "code": 400,
    "status": "error",
    "message": "appId is required.",
    "data": ""
}
```

appId不正确

```json
{
    "code": 400,
    "status": "error",
    "message": "application not found.",
    "data": ""
}
```

时间戳错误

```json
{
    "code": 400,
    "status": "error",
    "message": "invalid timestamp.",
    "data": ""
}
```

签名错误

```json
{
    "code": 403,
    "status": "error",
    "message": "invalid signature.",
    "data": ""
}
```

### php请求示例

```php
<?php
//引用config.php
include 'config.php';
$email = "xxxxx@xxxx.com";
$params = array(
  'appId' => $appId,
  'timestamp' => $timestamp,
  'email' => $email
);

//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法
$params['sign'] = $sign;

$url = "http://api.polyv.net/live/v2/app/get-custom-user?".http_build_query($params);

$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 500);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, 1);
$res = curl_exec($curl);
curl_close($curl);

echo $res;
?>
```
