黑名单

GET /api/v4/banned

获取黑名单

Query String Parameters:

/api/v4/clients

Success Response Body (JSON):

NameTypeDescription
codeInteger0
dataArray由对象构成的数组,对象中的字段与 POST 方法中的 Request Body 相同
metaObject/api/v4/clients

Examples:

获取黑名单列表:

  1. $ curl -i --basic -u admin:public -vX GET "http://localhost:8081/api/v4/banned"
  2. {"meta":{"page":1,"limit":10000,"count":1},"data":[{"who":"example","until":1582265833,"reason":"undefined","by":"user","at":1582265533,"as":"clientid"}],"code":0}

POST /api/v4/banned

将对象添加至黑名单

Parameters (json):

NameTypeRequiredDefaultDescription
whoStringRequired添加至黑名单的对象,可以是客户端标识符、用户名和 IP 地址
asStringRequired用于区分黑名单对象类型,可以是 clientidusernamepeerhost
byStringOptionaluser指示该对象被谁添加至黑名单
atIntegerOptional当前系统时间添加至黑名单的时间,单位:秒
untilIntegerOptional当前系统时间 + 5 分钟何时从黑名单中解除,单位:秒

Success Response Body (JSON):

NameTypeDescription
codeInteger0
dataObject与传入的 Request Body 相同

Examples:

将 client 添加到黑名单:

  1. $ curl -i --basic -u admin:public -vX POST "http://localhost:8081/api/v4/banned" -d '{"who":"example","as":"clientid"}'
  2. {"data":{"who":"example","as":"clientid"},"code":0}

DELETE /api/v4/banned/{as}/{who}

将对象从黑名单中删除

Parameters:

Success Response Body (JSON):

NameTypeDescription
codeInteger0
messageString仅在发生错误时返回,用于提供更详细的错误信息

Examples:

将 client 从黑名单中移除:

  1. $ curl -i --basic -u admin:public -X DELETE "http://localhost:8081/api/v4/banned/clientid/example"
  2. {"code":0}