geobaseTree

Get a geography reference.

Request format

https://adfox.yandex.com/api/v1
  ? object=account
  & action=utility
  & actionObject=geobaseTree
  & [hideChildren=<integer>]
  & [regionID=<integer>]

hideChildren

Display child elements of regions.

Acceptable values:

  • 0: A complete response with child elements displayed.
  • 1: A short response with child elements hidden. The number of such elements is displayed in the children_count field.

Default value: 0.

regionID

Initial node of the tree. The display of the tree begins with its child objects.

Default value: 10,000 — Whole world.

* Required

Response format

<response>
<status>
  <code>{integer}</code>
</status>
<result>
  <rows>{integer}</rows>
<data>
  <rowN>
    <id>{integer}</id>
    <name_ru>{string}</name_ru>
    <children_count>{integer}</children_count>
  </rowN>
  <rowN>
    <id>{integer}</id>
    <name_ru>{string}</name_ru>
    <children_count>{integer}</children_count>
  </rowN>
  <rowN>...</rowN>
  <rowN>...</rowN>
    ...
  <rowN>...</rowN>
</data>
</result>
</response>

Response parameters

code

Request processing status. If the value is 0, the request was completed successfully. For the key, see Error handling.

rows

Number of items in the response tree.

rowN

Item number in the response tree, where N is a number from 0 to rows-1 (where rows is the total number of items in the response).

id

Region ID.

name_ru

Country name.

children

The element has child regions, which are listed inside the tag (shown if the hideChildren=0 parameter value is used).

children_count

The element has child regions, and the number of child regions is specified inside the tag (shown if the hideChildren=1 parameter value is used).

Sample request and response

Request:

https://adfox.yandex.com/api/v1?object=account&action=utility&actionObject=geobaseTree&regionID=225

Response:

<response>
<status>
  <code>0</code>
</status>
<result>
  <rows>9</rows>
<data>
  <row0>
    <id>3</id>
    <name>Central Federal District</name>
    <children>
  <row0>
    <id>1</id>
    <name>Moscow and Moscow Oblast</name>
    <children>
   <row0>
    <id>213</id>
    <name>Moscow</name>
    <children/>
   </row0>
     </children>
   </row0>
   <row1>...</row1>
   <row2>...</row2>
     </children>
   </row0>
   <row1>...</row1>
   <row2>...</row2>
     ...
   <row8>...</row8>
</data>
</result>
</response>

Request:

https://adfox.yandex.com/api/v1?object=account&action=utility&actionObject=geobaseTree&regionID=225

Response:

<response>
<status>
  <code>0</code>
</status>
<result>
  <rows>9</rows>
<data>
  <row0>
    <id>3</id>
    <name>Central Federal District</name>
    <children>
  <row0>
    <id>1</id>
    <name>Moscow and Moscow Oblast</name>
    <children>
  <row0>
    <id>213</id>
    <name>Moscow</name>
    <children/>
  </row0>
    </children>
  </row0>
  <row1>...</row1>
  <row2>...</row2>
    </children>
  </row0>
  <row1>...</row1>
  <row2>...</row2>
    ...
  <row8>...</row8>
</data>
</result>
</response>

Request:

https://adfox.yandex.com/api/v1?object=account&action=utility&actionObject=geobaseTree&hideChildren=1&regionID=10000

Response:

<response>
<status>
  <code>0</code>
</status>
<result>
  <rows>8</rows>
<data>
  <row0>
    <id>138</id>
    <name_ru>Australia and Oceania</name_ru>
    <children_count>2</children_count>
  </row0>
  <row1>
    <id>183</id>
    <name_ru>Asia</name_ru>
    <children_count>8</children_count>
  </row1>
  <row2>...</row2>
  <row3>...</row3>
    ...
  <row7>...</row7>
</data>
</result>
</response>

Initial node of the tree. The display of the tree begins with its child objects.

Default value: 10,000 — Whole world.

Required

Display child elements of regions.

Acceptable values:

  • 0: A complete response with child elements displayed.

  • 1: A short response with child elements hidden. The number of such elements is displayed in the children_count field.

Default value: 0.