Query Country List

Query the list of available countries for creating a subordinate user.

Request URL

GET {base_url}/user/openapi/area/v1/page?{query parameters}

Request parameters

Headers
Parameter Required Description
User-Agent Yes Provide information about the user agent, such as the type of web browser, operating system, software version, etc., so as to help Yeastar Partner Portal to identify the user or the application that is making the request.

Example: User-Agent: OpenAPI.

Authorization Yes Pass the access token in the header, so as to authenticate the API request.

Format: Bearer {access_token}.

Query parameters
Parameter Required Type Description
pageSize No Integer Define how many records per page.

Default value: 25

pageNo No Integer Define which page is displayed.

Default value: 1

sort No String The sorting field and order.
Valid values:
  • name: Sort countries by name in ascending order.
  • -name: Sort countries by name in descending order.
name No String Search country by name.

Response parameters

Parameter Type Description
code String The response message of the API request.
detailMessage String The detailed error information.

When the request is successful, this parameter returns empty.

requestId String The unique ID of the request, which can be used to quickly locate the request.
result Object<Details> The information of the queried countries.
status Integer The HTTP status code of the API request.
Details
Parameter Type Description
count Integer The total number of countries.
pageNo Integer Which page is displayed.
pageSize Integer How many records are displayed per page.
results Array<Country_Info> The list of detailed country information.
total Integer The total number of countries.
totalPage Integer The total number of pages.
Country_Info
Parameter Type Description
code String Country code.
id Integer The unique ID of the country.
name String Country name.

Example

Request example
Query country list:
  • Display 5 records per page.
  • Display Page 1.
GET /user/openapi/area/v1/page?pageSize=5&pageNo=1 HTTP/1.1
Host: openapi.partner.yeastar.com
User-Agent: OpenAPI
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOlsicmVzMSJdLCJYLU1TLVVTRVIiOiJ7XCJleHByXCI6XCIwXCIsXCJ0eXBlXCI6XCJwYXJ0bmVyXCIsXCJ1Y0lkXCI6XCIzMDc2OTEzNjQ0ODkwODMyODk2XCIsXCJ1c2VyQ29kZVwiOlwiRGlzdHJpYnV0b3JcIixcInVzZXJJZFwiOlwiMzA3NjkxMzY0NDkxNTk5ODcyMFwiLFwidXNlcm5hbWVcIjpcImRpc3RyaWJ1dG9yZXhhbXBsZUBvdXRsb29rLmNvbVwifSIsInVzZXJfbmFtZSI6ImRpc3RyaWJ1dG9yZXhhbXBsZUBvdXRsb29rLmNvbSIsInNjb3BlIjpbImFsbCJdLCJleHAiOjE3MzkyNTgwMTUsInRva2VuX3R5cGUiOiJvcGVuYXBpIiwiYXV0aG9yaXRpZXMiOlsiNzciXSwianRpIjoibDkzTXhVMWlWYm1MeEhuOWkrdzRVaitqZ0JZPSIsImNsaWVudF9pZCI6ImFjMGYyZTViZWU3NmI2ZDdmNDU0NTY5NmMyNGZjMWYzIn0.4jMWQBsRMZp2Q0Lxo_NTOsM2V89r4FphvKlDe667oCA

Response example

{
    "code": "success",
    "detailMessage": "",
    "requestId": "89b10b3715bbbb596121ca1b1fb4fc9d",
    "result": {
        "count": 244,
        "pageNo": 1,
        "pageSize": 5,
        "results": [
            {
                "code": "Afghanistan",
                "id": "1",
                "name": "Afghanistan"
            },
            {
                "code": "Aland Islands",
                "id": "2",
                "name": "Aland Islands"
            },
            {
                "code": "Albania",
                "id": "3",
                "name": "Albania"
            },
            {
                "code": "Algeria",
                "id": "4",
                "name": "Algeria"
            },
            {
                "code": "American Samoa",
                "id": "5",
                "name": "American Samoa"
            }
        ],
        "total": 244,
        "totalPage": 49
    },
    "status": 200
}