Global IP Database

Change IP Database

Description

Change IP database

URI

PUT /admin-api/global/1/ip

JSON body

{
  "token":"xxx-xxx-xxx-xxx", // only ipdb, maxmind and maxmind_lite need token
  "database_type": "maxmind_lite" // [ipdb, maxmind, maxmind_lite, qqzeng]
}

Example Request

Shell

curl -X PUT \
  -H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  https://{admin-site}/admin-api/global/1/ip \
  -d $'{"token":"1df87165-3593-4eca-a910-9ac20005e6ec","database_type": "ipdb"}'

Example Response

Status: 200 OK
{"status":0}

Upload qqzeng IP Database

Description

Upload qqzeng IP database, and will change the IP database type to qqzeng

URI

POST /admin-api/ip_database/upload_qqzeng

Example Request

Shell

curl -X POST \
  -H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  https://{admin-site}/admin-api/ip_database/upload_qqzeng -F "filename=@/path/qqzeng-ip-utf8.dat"

Example Response

Status: 200 OK

{"status":0,"time":1620793265,"data":"wait for qqzeng database processing to complete..."}

Upload User IP Database

Description

Upload user IP database, the file format should be csv like this:

network,continent_iso_code,country_iso_code,country_name_en,province_name_en,city_name_en,latitude,longtitude,isp
34.64.0.0/24,AS,KR,South Korea,,,37.46910095214844,126.45099639892578,
34.64.1.0/24,AS,KR,South Korea,,,37.46910095214844,126.45099639892578,
34.64.2.0/24,AS,KR,South Korea,,,37.46910095214844,126.45099639892578,

URI

POST /admin-api/ip_database/upload_user_database

URI Parameters

  • name

    type: string

    required: yes

Example Request

Shell

curl -X POST \
  -H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  https://{admin-site}/admin-api/ip_database/upload_user_database?name=google-dns -F "filename=@/path/dns.csv"

Example Response

Status: 200 OK

{"status":0,"time":1620793265,"data":"wait for merging user database processing to complete..."}

Get Current User Databases

Description

Get current user databases

URI

GET /admin-api/ip_database/user_databases

Example Request

Shell

curl \
  -H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  https://{admin-site}/admin-api/ip_database/user_databases

Example Response

Status: 200 OK
{
    "time": 1622620367,
    "data": [
        {
            "name": "google-dns",
            "id": 1,
            "_created_unix": "2021-06-01 23:25:12.999406-07",
            "data": "base64-data"
        }
    ],
    "status": 0
}

Delete User Database

Description

Delete user database

URI

DELETE /admin-api/ip_database/user_database

URI Parameters

  • name

    type: string

    required: yes

Example Request

Shell

curl -X DELETE \
  -H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  https://{admin-site}/admin-api/ip_database/user_database?name=google-dns

Example Response

Status: 200 OK
{
    "time": 1622620367,
    "data": true,
    "status": 0
}

Get Current IP Database

Description

Get current IP database

URI

GET /admin-api/ip_database/current

Example Request

Shell

curl \
  -H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  https://{admin-site}/admin-api/ip_database/current

Example Response

Status: 200 OK

{"status":0,"time":1620793740,"data":{"database_type":"qqzeng","version":"7621aa9f75536d100b73fdc8910cfbd30f9ddbd8"}}

Search Current IP Database Meta Data

Description

Search current IP database meta data (only support qqzeng IP database)

Only one type of keyword can be specified

URI

GET /admin-api/ip_database/meta

URI parameter

  • country_keyword

    type: string

    required: no

    description: Country search keyword, cannot be used with other keyword parameter

  • province_keyword

    type: string

    required: no

    description: Province search keyword, cannot be used with other keyword parameter

  • city_keyword

    type: integer

    required: no

    description: City search keyword, cannot be used with other keyword parameter

Example Request

Shell

curl \
  -H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  https://{admin-site}/admin-api/ip_database/current?country_keyword=Mala

Example Response

Status: 200 OK
{
    "data": {
        "database_type": "qqzeng",
        "meta": [
            [
                "Malaysia", // CountryEn
            ]
        ]
    },
    "time": 1620797549,
    "status": 0
}