0
Answered

Можно ли ввести ограничение по нескольким city_kladr_id?

Anonymous 2 years ago updated 2 years ago 2

Передаю

array:2 [
  "query" => "Текстильная"
  "locations" => array:1 [
    "kladr_id" => array:6 [
      0 => "7700000000000"
      1 => "5000002800000"
      2 => "7800000000000"
      3 => "4000000100000"
      4 => "2900000100000"
      5 => "7100000100000"
    ]
  ]
]

на выходе
array:3 [
  "family" => "CLIENT_ERROR"
  "reason" => "Bad Request"
  "message" => """
    Can not deserialize instance of java.util.ArrayList out of START_OBJECT token\n
     at [Source: org.apache.cxf.transport.http.AbstractHTTPDestination$1@47371bef; line: 1, column: 91] (through reference chain: ru.hflabs.sgt.model.address.SuggestAddressRequest["locations"])
    """
]

Answer

Answer
Answered

Можно, только структура запроса будет немного отличаться:

$locations = array(
  array("kladr_id" => "7700000000000"),
  array("kladr_id" => "5000002800000"),
  array("kladr_id" => "7800000000000"),
  array("kladr_id" => "4000000100000"),
  array("kladr_id" => "2900000100000"),
  array("kladr_id" => "7100000100000")
);

$request = array(
  "query" => "Текстильная",
  "locations" => $locations
);
Answer
Answered

Можно, только структура запроса будет немного отличаться:

$locations = array(
  array("kladr_id" => "7700000000000"),
  array("kladr_id" => "5000002800000"),
  array("kladr_id" => "7800000000000"),
  array("kladr_id" => "4000000100000"),
  array("kladr_id" => "2900000100000"),
  array("kladr_id" => "7100000100000")
);

$request = array(
  "query" => "Текстильная",
  "locations" => $locations
);