返回简略文档

API文档

IUCA API接口文档

1. [IDC信息查询API](#idc信息查询api)

2. [违规用户API](#违规用户api)

此API提供了IDC信息的查询功能,包括获取IDC列表、单个IDC详情和可用平台列表。支持分页、搜索和多平台查询功能。

- 方式1: 请求头中包含 API-Key: your_api_key

- 方式2: 查询参数中包含 apikey=your_api_key

#### 1. 获取可用平台列表

- action: 固定值get_platforms

json

{

"platforms": [

{

"code": "iuca",

"name": "IUCA平台",

"is_editable": true

},

{

"code": "idcams",

"name": "IDCAMS平台",

"is_editable": false

},

{

"code": "hanhaiyun",

"name": "瀚海云平台",

"is_editable": false

}

],

"default_platform": "iuca"

}

#### 2. 获取IDC信息列表

- page: 页码(默认: 1)

- page_size: 每页数量(默认: 20,最大: 100)

- idc_name: IDC名称搜索(模糊匹配)

- domain: 域名搜索(模糊匹配)

- tags: 标签搜索(模糊匹配)

- platform: 平台代码,多个平台使用逗号分隔,例如:iuca,idcams,不指定则使用默认平台

json

{

"total": 100,

"page": 1,

"page_size": 20,

"platforms": ["iuca", "idcams"],

"data": [

{

"id": 1,

"idc_name": "示例IDC",

"website": "https://example.com",

"introduction": "示例IDC简介",

"authentication_type": "实名认证",

"operator_type": "企业",

"platform": "iuca",

"created_at": "2023-08-02 14:30:00",

"tags": ["高防", "CN2", "BGP"],

"logo_path": "/images/logo.png",

"verification_status": "verified",

"last_verification_date": "2023-09-01 10:00:00"

},

{

"id": 2,

"idc_name": "IDCAMS示例",

"website": "https://example2.com",

"platform": "idcams",

"created_at": "2023-08-03 10:00:00",

"tags": ["云服务器"],

"verification_status": "verified",

"last_verification_date": "2023-09-02 10:00:00"

},

...

]

}

#### 3. 获取单个IDC详情

- id: IDC信息ID(必需)

- platform: 平台代码,不指定则使用默认平台

json

{

"id": 1,

"idc_name": "示例IDC",

"website": "https://example.com",

"introduction": "示例IDC简介",

"authentication_type": "实名认证",

"operator_type": "企业",

"platform": "iuca",

"created_at": "2023-08-02 14:30:00",

"tags": ["高防", "CN2", "BGP"],

"logo_path": "/images/logo.png",

"verification_status": "verified",

"last_verification_date": "2023-09-01 10:00:00",

"identifiers": [

{

"identifier": "EXAMPLE001",

"platform": "iuca"

},

{

"identifier": "ID001",

"platform": "idcams"

}

]

}

- 方式1: 请求头中包含 API-Key: your_api_key

- 方式2: 查询参数中包含 apikey=your_api_key

- page: 页码(默认: 1)

- page_size: 每页数量(默认: 20)

- name: 姓名搜索(模糊匹配)

- contact_info: 联系方式搜索(模糊匹配)

- ip_addresses: IP地址搜索(模糊匹配)

- status: 状态筛选(可选值: approved, pending, modification_pending),默认只返回approved和modification_pending状态的用户

json

{

"total": 100,

"page": 1,

"page_size": 20,

"data": [

{

"id": 1,

"name": "张三",

"contact_info": ["zhangsan@example.com", "13800138000"],

"contact_type": ["email", "phone"],

"ip_addresses": "192.168.1.1, 10.0.0.1",

"reporter_email": "admin@example.com",

// 注意:不能直接设置为'appoved',系统会自动设置为'modification_pending'

// "status": "approved", // 此参数无效

"created_at": "2023-08-02 14:30:00",

"reasons": ["违规内容1", "违规内容2"]

},

...

]

}

- id: 违规用户ID(必需)

json

{

"id": 1,

"name": "张三",

"contact_info": ["zhangsan@example.com", "13800138000"],

"contact_type": ["email", "phone"],

"ip_addresses": "192.168.1.1, 10.0.0.1",

"reporter_email": "admin@example.com",

"status": "approved",

"created_at": "2023-08-02 14:30:00",

"reasons": ["违规内容1", "违规内容2"]

}

json

{

"name": "张三",

"contact_info": ["zhangsan@example.com", "13800138000"],

"contact_type": ["email", "phone"],

"ip_addresses": "192.168.1.1, 10.0.0.1",

"reporter_email": "admin@example.com",

// 注意:status参数会被忽略,新添加用户总是设置为'pending'

"status": "pending", // 此参数会被忽略

"reasons": ["违规内容1", "违规内容2"]

}

- contact_info: 联系方式数组(至少一个)

- contact_type: 联系方式类型数组(与联系方式数量匹配)

- reporter_email: 有效的邮箱地址

- reasons: 违规原因数组(至少一个非空)

- id: 违规用户ID(必需)

json

{

"name": "张三(更新)",

"status": "approved",

"reasons": ["更新后的违规原因"]

}

API会返回适当的HTTP状态码和错误信息:

错误响应格式:

json

{

"error": "错误描述信息"

}

bash

curl -X GET "http://yourdomain.com/api/violation_users_api.php?page=1&page_size=10&name=张三" \

-H "API-Key: your_api_key"

bash

curl -X GET "http://yourdomain.com/api/violation_users_api.php?page=1&page_size=10&name=张三&apikey=your_api_key"

bash

curl -X POST "http://yourdomain.com/api/violation_users_api.php" \

-H "Content-Type: application/json" \

-H "API-Key: your_api_key" \

-d '{"name":"张三","contact_info":["zhangsan@example.com"],"contact_type":["email"],"reporter_email":"admin@example.com","reasons":["违规内容"]}'

bash

curl -X POST "http://yourdomain.com/api/violation_users_api.php?apikey=your_api_key" \

-H "Content-Type: application/json" \

-d '{"name":"张三","contact_info":["zhangsan@example.com"],"contact_type":["email"],"reporter_email":"admin@example.com","reasons":["违规内容"]}'

bash

curl -X PUT "http://yourdomain.com/api/violation_users_api.php/1" \

-H "Content-Type: application/json" \

-H "API-Key: your_api_key" \

-d '{"name":"张三(更新)","reasons":["更新后的违规原因"]}'

bash

curl -X PUT "http://yourdomain.com/api/violation_users_api.php/1?apikey=your_api_key" \

-H "Content-Type: application/json" \

-d '{"name":"张三(更新)","reasons":["更新后的违规原因"]}'

bash

curl -X DELETE "http://yourdomain.com/api/violation_users_api.php/1" \

-H "API-Key: your_api_key"

bash

curl -X DELETE "http://yourdomain.com/api/violation_users_api.php/1?apikey=your_api_key"