子用户

下面提供的链接指向一个页面,该页面详细介绍了我们系统内的“子用户”的概念。

子用户


请注意,几乎每个端点都与子用户相关,除了值得注意的 indexdelete 端点等例外情况外,将在成功调用时返回一个子用户资源。

SubuserResource
{
    "id": 5,
    "hash": "01HQ5K3P97DY8EX9Y90YT1K6XA",
    "username": "subuser_231",
    "password": "asffqwv2f3w4214v",
    "traffic_available": 0.25,
    "traffic_used": 0
}

注意,请勿使用 id 字段。该字段已过时,在未来将被移除。


当通过创建或更新的方式给子用户增加流量时,流量会从主账号中扣除。同样,当您删除子用户或从子用户中获取流量时,它将返回给主用户。


创建子用户

POST /residential-subusers

正文参数

請求範例

curl -X POST https://resi-api.iproyal.com/v1/residential-subusers \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer <your_api_token>" \
     -d '{
           "username": "subuser123",
           "password": "securepassword",
           "traffic": 10.0
         }'

获取子用户

GET /residential-subusers/{ hash }

查询参数

請求範例

curl -X GET "https://resi-api.iproyal.com/v1/residential-subusers/<subuser_hash>" \
     -H "Authorization: Bearer <your_api_token>"

获取多个子用户

GET /residential-subusers

查询参数

請求範例

curl -X GET "https://resi-api.iproyal.com/v1/residential-subusers?page=1&per_page=10&search=username_search" \
     -H "Authorization: Bearer <your_api_token>"

更新子用户

UPDATE /residential-subusers/{ hash }

查询参数

正文参数

請求範例

curl -X PUT "https://resi-api.iproyal.com/v1/residential-subusers/<subuser_hash>" \
     -H "Authorization: Bearer <your_api_token>" \
     -H "Content-Type: application/json" \
     -d '{
           "username": "new_username",
           "password": "new_password",
           "traffic": 5.0
         }'

Delete Sub-User

DELETE /residential-subusers/{ hash }

查询参数

請求範例

curl -X DELETE "https://resi-api.iproyal.com/v1/residential-subusers/<subuser_hash>" \
     -H "Authorization: Bearer <your_api_token>" \
     -H "Content-Type: application/json"