Модель Street (инфо. улицы)
Модель Street — представляет справочник улиц
* @property integer $id * @property string $title // название * @property integer $city_id // id города * @property string $type // тип улицы, может принимать значения: street - Улица bulvar - Бульвар pereulok - Переулок prospect - Проспект proezd - Проезд dead_end - Тупик highway - Шоссе embankment - Набережная square - Площадь microdistrict - Микрорайон
Пример получения списка улиц
curl --location --request GET 'https://{DOMAIN NAME}/rest/api/street' \
--header 'Content-Type: application/json' \
--header 'X-REST-API-KEY: {REST API KEY}'Ответ сервера
{
"success": true,
"message": "Records Retrieved Successfully",
"data": {
"totalCount": "3",
"street": [
{
"id": "1",
"title": "улица Шевченко",
"city_id": "254",
"type": "street",
"city": {
"id": "254",
"title": "город Счастья",
"type_id": "1"
}
},
{
"id": "2",
"title": "улица Некрасова",
"city_id": "254",
"type": "street",
"city": {
"id": "254",
"title": "город Счастья",
"type_id": "1"
}
},
{
"id": "3",
"title": "улица Каштановая",
"city_id": "254",
"type": "street",
"city": {
"id": "254",
"title": "город Счастья",
"type_id": "1"
}
}
]
}
}Пример запроса поиска улицы
curl --location -g --request GET 'https://{DOMAIN NAME}/rest/api/street?filter=[{"property":"title","value":"Шевчен","operator":"like"}]' \
--header 'Content-Type: application/json' \
--header 'X-REST-API-KEY: {REST API KEY}'Ответ сервера
{
"success": true,
"message": "Records Retrieved Successfully",
"data": {
"totalCount": "1",
"street": [
{
"id": "1",
"title": "улица Шевченко",
"city_id": "254",
"type": "street",
"city": {
"id": "254",
"title": "город Счастья",
"type_id": "1"
}
}
]
}
}Пример добавления записи
curl --location --request POST 'https://{DOMAIN NAME}/rest/api/street' \
--header 'Content-Type: application/json' \
--header 'X-REST-API-KEY: {REST API KEY}'
--data-raw '{
"title": "проспект Чайный",
"city_id": 254,
"type": "prospect"
}'Ответ сервера
{
"success": true,
"message": "Record(s) Created",
"data": {
"totalCount": 1,
"street": [
{
"title": "проспект Чайный",
"city_id": 254,
"type": "prospect",
"id": "4"
}
]
}
}Получение списка типов улиц
curl --location --request GET 'https://{DOMAIN NAME}/rest/api/street/TypesStreets' \
--header 'Content-Type: application/json' \
--header 'X-REST-API-KEY: {REST API KEY}'Ответ сервера
{
"data": {
"types_streets": [
{
"id": "street",
"title": "Улица"
},
{
"id": "bulvar",
"title": "Бульвар"
},
{
"id": "prospect",
"title": "Проспект"
},
{
"id": "pereulok",
"title": "Переулок"
},
{
"id": "proezd",
"title": "Проезд"
},
{
"id": "dead_end",
"title": "Тупик"
},
{
"id": "highway",
"title": "Шоссе"
},
{
"id": "embankment",
"title": "Набережная"
},
{
"id": "square",
"title": "Площадь"
},
{
"id": "microdistrict",
"title": "Микрорайон"
}
]
},
"success": true
}