Application IP List

New Application IP List

URI

POST /admin-api/applications/{app_id}/ip_list

JSON body

  • name

    type: string

    required: yes

    description: name of application IP list

  • type

    type: string

    required: yes

    description: type of application 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" \
  http://admin-site/admin-api/applications/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 Application IP List (Override)

URI

PUT /admin-api/applications/{app_id}/ip_list/{ip_list_id}

Request example

Shell

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

Response example

Status: 200 OK
{ "status":0 }

Append to Application IP List

URI

PUT /admin-api/app_ip_list/{app_id}/append/{ip_list_id}

Request example

Shell

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

Response example

Status: 200 OK
{ "status":0 }

Fetch Application IP List

URI

GET /admin-api/Application/{app_id}/ip_list

Request example

Shell

curl \
  -H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  http://admin-site/admin-api/applications/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/applications/{app_id}/ip_list/{ip_list_id}

Request example

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

Response example

Status: 200 OK
{"status": 0}