Global IP List

New Global IP List

URI

POST /admin-api/global/1/ip_list

JSON body

  • name

    type: string

    required: yes

    description: name of global IP list

  • type

    type: string

    required: yes

    description: type of global IP list, value can be ‘ipv4’ or ‘ipv6’

  • items

    type: array

    required: yes

    description: list of IP address objects

  • items.ip

    type: IP

    required: yes

    description: IP address (ipv4 or ipv6)

Request example

Shell

curl \
  -X POST \
  -H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  https://admin-site/admin-api/global/1/ip_list \
  -d '{
      "name": "ip-list-1",
      "type": "ipv4",
      "items": [
        {"ip": "127.0.0.1"},
        {"ip": "127.0.0.2/32"}
      ]
  }'

Response example

Status: 200 OK
{ "status":0, "data": {"id": 1} }

Modify the Global IP List (Override)

URI

PUT /admin-api/global/1/ip_list/{ip_list_id}

Request example

Shell

curl \
  -X PUT \
  -H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  https://admin-site/admin-api/global/1/ip_list/1 \
  -d '{
      {"items":[{"ip":"10.0.0.100"}]}
  }'

Response example

Status: 200 OK
{ "status":0 }

Append to Global IP List

URI

PUT /admin-api/ip_list/append

Request example

Shell

curl \
  -X PUT \
  -H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  https://admin-site/admin-api/ip_list/{ip_list_id}/append \
  -d '{
      "items":[{"ip":"10.0.0.101"}]
  }'

Response example

Status: 200 OK
{ "status":0 }

Fetch Global IP List

URI

GET /admin-api/global/1/ip_list

Request example

Shell

curl \
  -H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  https://admin-site/admin-api/global/1/ip_list

Response example

Status: 200 OK
{
  "data": [
    {
      "id": 1,
      "items": [
        { "id": 1, "ip": "127.0.0.1" },
        { "id": 2, "ip": "127.0.0.2" }
      ],
      "name": "ip-list-1",
      "type": "ipv4"
    }
  ],
  "status": 0
}

Remove IP List by id

URI

DELETE /admin-api/global/1/ip_list/{ip_list_id}

Request example

curl \
  -X DELETE \
  -H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  https://admin-site/admin-api/global/1/ip_list/1

Response example

Status: 200 OK
{"status": 0}