Skip to content

Instantly share code, notes, and snippets.

@pioh
Last active January 20, 2017 09:06
Show Gist options
  • Save pioh/915142fd2c89e46b2b0d101874f0294f to your computer and use it in GitHub Desktop.
Save pioh/915142fd2c89e46b2b0d101874f0294f to your computer and use it in GitHub Desktop.
getStats
POST: /api/getStats?token=eyJhbGciO // Нужен POST а не GET потому что полигоны могут не влезть в ограничение GET на 3-4Kb.
REQUEST:
{
"filter": { // все поля которые есть в фильтре по запросу api/filterOffers
"price": {
"from": null,
"to": null
},
"trusted": null,
"separateEntrance": null,
"photoRequired": null,
"date": {
"from": null,
"to": null
},
"location": [
{// Прямоугольники и круги буду при запросе для упрощения преобразовывать в полигоны.
"polygon": [
[ // внешний контур
[55.7715, 37.6856],
[55.7764, 37.6953],
[55.7764, 37.6953],
[55.7764, 37.6953],
[55.7764, 37.6953],
],
[ // внутренний контур
[55.7715, 37.6856],
[55.7764, 37.6953],
[55.7764, 37.6953],
],
// ...
]
},
{
"polygon": [[
[55.7715, 37.6856],
[55.7764, 37.6953],
[55.7764, 37.6953],
[55.7764, 37.6953],
[55.7764, 37.6953],
]]
}
{
"polygon": [[
[55.7715, 37.6856],
[55.7764, 37.6953],
[55.7764, 37.6953],
[55.7764, 37.6953],
[55.7764, 37.6953],
]]
}
],
"space": {
"from": null,
"to": null
},
"floor": {
"from": null,
"to": null
},
"floorHint": {
"notFirst": null,
"notLast": null
},
"storeys": {
"from": null,
"to": null
},
"furniture": null,
"shopWindow": null,
"rooms": {
"from": null,
"to": null
},
"living": {
"from": null,
"to": null
},
"kitchen": {
"from": null,
"to": null
},
"pricePerMeter": {
"from": null,
"to": null
}
}
}
RESPONSE:
{
stats: {
countByRealtyType: {
OFFICE: 123,
},
averagePricePerMeterByRealtyType: {
OFFICE: 10000,
},
minPricePerMeterByRealtyType: {
OFFICE: 1000,
},
maxPricePerMeterByRealtyType: {
OFFICE: 100000,
},
},
error: { // null или undefined если нет ошибки
message: "Произошла внутренняя ошибка.",
type: "INTERNAL_ERROR",
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment