Local

Query countries, regions and provinces


curl --location --request GET 'https://api.98ip.com/region/getList?region=AL'

import requests

url = "https://api.98ip.com/region/getList?region=AL"

payload={}
headers = {}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
   CURLOPT_URL => 'https://api.98ip.com/region/getList?region=AL',
   CURLOPT_RETURNTRANSFER => true,
   CURLOPT_ENCODING => '',
   CURLOPT_MAXREDIRS => 10,
   CURLOPT_TIMEOUT => 0,
   CURLOPT_FOLLOWLOCATION => true,
   CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
   CURLOPT_CUSTOMREQUEST => 'GET',
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

var requestOptions = {
   method: 'GET',
   redirect: 'follow'
};

fetch("https://api.98ip.com/region/getList?region=AL", requestOptions)
   .then(response => response.text())
   .then(result => console.log(result))
   .catch(error => console.log('error', error));

package main

import (
   "fmt"
   "net/http"
   "io/ioutil"
)

func main() {

   url := "https://api.98ip.com/region/getList?region=AL"
   method := "GET"

   client := &http.Client {
   }
   req, err := http.NewRequest(method, url, nil)

   if err != nil {
      fmt.Println(err)
      return
   }
   res, err := client.Do(req)
   if err != nil {
      fmt.Println(err)
      return
   }
   defer res.Body.Close()

   body, err := ioutil.ReadAll(res.Body)
   if err != nil {
      fmt.Println(err)
      return
   }
   fmt.Println(string(body))
}

OkHttpClient client = new OkHttpClient().newBuilder()
   .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
   .url("https://api.98ip.com/region/getList?region=AL")
   .method("GET", body)
   .build();
Response response = client.newCall(request).execute();

GET /region/getList

Request parameters

Name Types Required Explanation
region string No The code of a country - query the province of the country, the id of a province - query the city of the province (choose one from pid)
pid string No 0- means to query all countries and regions, country id- to query the province of the country, province id- to query the city in the province (the priority is higher than region, and the region is selected)
                                    
https://api.98ip.com/region/getList?region=AL

                                

Corresponding results

Name Types Explanation
code int Response code
msg string Response message
data list List of countries
                                        
{
    "code": 0,
    "msg": "string",
    "data": [
        {
            "id": 0,
            "name": "string",
            "code": "string"
        }
    ]
}

                                    
                                        
{
  "code": 1,
  "msg": "<string>"
}

                                    

curl --location --request GET 'https://api.98ip.com/region/getList?region=AL'

import requests

url = "https://api.98ip.com/region/getList?region=AL"

payload={}
headers = {}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
   CURLOPT_URL => 'https://api.98ip.com/region/getList?region=AL',
   CURLOPT_RETURNTRANSFER => true,
   CURLOPT_ENCODING => '',
   CURLOPT_MAXREDIRS => 10,
   CURLOPT_TIMEOUT => 0,
   CURLOPT_FOLLOWLOCATION => true,
   CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
   CURLOPT_CUSTOMREQUEST => 'GET',
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

var requestOptions = {
   method: 'GET',
   redirect: 'follow'
};

fetch("https://api.98ip.com/region/getList?region=AL", requestOptions)
   .then(response => response.text())
   .then(result => console.log(result))
   .catch(error => console.log('error', error));

package main

import (
   "fmt"
   "net/http"
   "io/ioutil"
)

func main() {

   url := "https://api.98ip.com/region/getList?region=AL"
   method := "GET"

   client := &http.Client {
   }
   req, err := http.NewRequest(method, url, nil)

   if err != nil {
      fmt.Println(err)
      return
   }
   res, err := client.Do(req)
   if err != nil {
      fmt.Println(err)
      return
   }
   defer res.Body.Close()

   body, err := ioutil.ReadAll(res.Body)
   if err != nil {
      fmt.Println(err)
      return
   }
   fmt.Println(string(body))
}

OkHttpClient client = new OkHttpClient().newBuilder()
   .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
   .url("https://api.98ip.com/region/getList?region=AL")
   .method("GET", body)
   .build();
Response response = client.newCall(request).execute();