Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Перевели справочники регионов в OpenAPI #786

Merged
merged 2 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 3 additions & 100 deletions docs/areas.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,107 +2,10 @@

> ‼️ Внимание! Значения в справочниках могут поменяться в любой момент. Не нужно завязываться на них.

* [Дерево всех регионов](#areas)
* [Справочник регионов, начиная с указанного](#item)
* [Справочник стран](#countries)
* [Дополнительные параметры запроса](#additional_parameters)
* [Дерево всех регионов](https://api.hh.ru/openapi/redoc#tag/Obshie-spravochniki/operation/get-areas)
* [Справочник регионов, начиная с указанного](https://api.hh.ru/openapi/redoc#tag/Obshie-spravochniki/operation/get-areas-from-specified)
* [Справочник стран](https://api.hh.ru/openapi/redoc#tag/Obshie-spravochniki/operation/get-countries)

### Смотрите также

* [Подсказки по полному дереву регионов и листам дерева регионов](suggests.md#areas)


<a name="areas"></a>
## Дерево всех регионов

`GET /areas` возвращает древовидный список всех регионов с указанием названия
региона, его идентификатором и ссылкой на родительский регион `parent_id`.

```json
[
{
"name": "Казахстан",
"id": "40",
"parent_id": null,
"areas": [
{
"id": "6251",
"parent_id": "40",
"name": "Абай",
"areas": []
}
]
}
]
```

Пример: [https://api.hh.ru/areas](https://api.hh.ru/areas)


<a name="item"></a>
## Справочник регионов, начиная с указанного

`GET /areas/{area_id}` вернёт древовидный список регионов, начиная с указанного.

Пример: [https://api.hh.ru/areas/1146](https://api.hh.ru/areas/1146)


<a name="countries"></a>
## Справочник стран

`GET /areas/countries` вернёт подмножество регионов, являющихся странами.

Пример ответа:

```json
[
{
"url": "https://api.hh.ru/areas/113",
"id": "113",
"name": "Россия"
},
{
"url": "https://api.hh.ru/areas/6",
"id": "6",
"name": "Австралия"
}
]
```

<a name="additional_parameters"></a>
## Дополнительные параметры запроса

Только для русской локализации можно получить дополнительное поле - название area в предложном падеже. Для этого нужно передать query параметр:

`GET /areas/{area_id}?additional_case=prepositional`

Пример: [https://api.hh.ru/areas/1?additional_case=prepositional](https://api.hh.ru/areas/1?additional_case=prepositional)

```json
{
"id": "1",
"parent_id": "113",
"name": "Москва",
"areas": [],
"name_prepositional": "в Москве"
}
```

### Ошибки при запросе

При передаче не поддерживаемого падежа возвращается ошибка

`GET /areas/{area_id}?additional_case=wrong_case`

Пример: [https://api.hh.ru/areas/1?additional_case=wrong_case](https://api.hh.ru/areas/1?additional_case=wrong_case)

```json
{
"errors": [
{
"type": "bad_argument",
"value": "wrong_case"
}
]
}
```
2 changes: 1 addition & 1 deletion docs/employer_negotiations.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ per_page | нет | Количество выдаваемых элементов
age_from | нет | Возраст соискателя в годах, диапазон от
age_to | нет | Возраст соискателя в годах, диапазон до
area | нет | Регион. Можно передать множественные значения. Возможные значения: [/areas](https://github.com/hhru/api/blob/master/docs/areas.md)
citizenship | нет | Страна желаемого гражданства. Можно передать множественные значения. Возможные значения можно посмотреть в [справочнике стран](areas.md#countries)
citizenship | нет | Страна желаемого гражданства. Можно передать множественные значения. Возможные значения можно посмотреть в [справочнике стран](https://api.hh.ru/openapi/redoc#tag/Obshie-spravochniki/operation/get-countries)
currency | нет | Код валюты. Возможные значения: `currency` (ключ code) в [/dictionaries](https://api.hh.ru/openapi/redoc#tag/Obshie-spravochniki/operation/get-dictionaries
driver_license_types | нет | Категории водительских прав. Можно передать множественные значения. Возможные значения: `driver_license_types` в [/dictionaries](https://api.hh.ru/openapi/redoc#tag/Obshie-spravochniki/operation/get-dictionaries)
educational_institution | нет | Идентификатор [учебного заведения](https://github.com/hhru/api/blob/master/docs/suggests.md). Можно передать множественные значения
Expand Down
100 changes: 3 additions & 97 deletions docs_eng/areas.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,104 +2,10 @@

> Attention! The values in the directories may change at any time. Do not address them directly.

* [Tree view of all regions](#areas)
* [Region directory, starting from the indicated region](#item)
* [Countries](#countries)
* [Additional request parameters](#additional_parameters)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тут внизу по не удалил?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

исправил

* [Tree view of all regions](https://api.hh.ru/openapi/en/redoc#tag/Public-directories/operation/get-areas)
* [Region directory, starting from the indicated region](https://api.hh.ru/openapi/en/redoc#tag/Public-directories/operation/get-areas-from-specified)
* [Countries](https://api.hh.ru/openapi/en/redoc#tag/Public-directories/operation/get-countries)

See also:

* [Region suggestions](suggests.md#areas)


<a name="areas"></a>
## Tree view of all regions

`GET /areas` returns a tree view list of all regions with the indication of
region name and ID and the link to a parent region `parent_id`.

```json
[
{
"name": "Kazakhstan",
"id": "40",
"parent_id": null,
"areas": [
{
"name": "Abai",
"id": "6251",
"parent_id": "40",
"areas": []
}
]
}
]
```

Example: [https://api.hh.ru/areas?locale=EN](https://api.hh.ru/areas?locale=EN)


<a name="item"></a>
## Region directory, starting from the indicated region

`GET /areas/{area_id}` returns the region tree view list, starting from the
indicated region.

Example: [https://api.hh.ru/areas/1146?locale=EN](https://api.hh.ru/areas/1146?locale=EN)


<a name="countries" />
## Countires

`GET /areas/countries` returns the regions list with countries.

```json
[
{
"url": "https://api.hh.ru/areas/113",
"id": "113",
"name": "Russia"
},
{
"url": "https://api.hh.ru/areas/6",
"id": "6",
"name": "Australia"
}
]
```
<a name="additional_parameters"></a>
## Additional request parameters

Only for Russian localization, you can get an additional field — area name in prepositional case. To do this, pass the query parameter:

`GET /areas/{area_id}?additional_case=prepositional`

Example: [https://api.hh.ru/areas/1?additional_case=prepositional](https://api.hh.ru/areas/1?additional_case=prepositional)

```json
{
"id": "1",
"parent_id": "113",
"name": "Москва",
"areas": [],
"name_prepositional": "в Москве"
}
```

### Errors when querying
Passing an unsupported case returns the error

`GET /areas/{area_id}?additional_case=wrong_case`

Example: [https://api.hh.ru/areas/1?additional_case=wrong_case](https://api.hh.ru/areas/1?additional_case=wrong_case)

```json
{
"errors": [
{
"type": "bad_argument",
"value": "wrong_case"
}
]
}
```
2 changes: 1 addition & 1 deletion docs_eng/employer_negotiations.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ per_page | no | Number of items per page: default value is 20; the maximum value
age_from | no | Applicant's age in years, range from
age_to | no | Applicant's age in years, range up to
area | no | Area. Multiple values can be specified. Possible values: [/areas](https://github.com/hhru/api/blob/master/docs/areas.md)
citizenship | no | Country of desired citizenship. Multiple values can be specified. Possible values can be found in the [country dictionary](areas.md#countries)
citizenship | no | Country of desired citizenship. Multiple values can be specified. Possible values can be found in the [country dictionary](https://api.hh.ru/openapi/en/redoc#tag/Public-directories/operation/get-countries)
currency | no | Currency code. Possible values: `currency` (key=code) from [/dictionaries](https://api.hh.ru/openapi/redoc#tag/Obshie-spravochniki/operation/get-dictionaries
driver_license_types | no | Driver license categories. Multiple values can be specified. Possible values: `driver_license_types` from [/dictionaries](https://api.hh.ru/openapi/redoc#tag/Obshie-spravochniki/operation/get-dictionaries)
educational_institution | no | ID of the [educational institution](https://github.com/hhru/api/blob/master/docs_eng/suggests.md). Multiple values can be specified
Expand Down
Loading