23 $endpointParts = explode(
'/', $this->getRequest()->getEndpoint());
25 $parsed = is_array($data) ? $data : Json::decode($data);
27 if (isset($parsed[
'errors']))
31 $this->setData(array());
35 $this->addError(
new Error($parsed[
'message'], $parsed[
'code']));
39 if (isset($parsed[$endpointParts[0]]))
41 $this->setData($parsed[$endpointParts[0]]);
43 else if(!isset($parsed[
'errors']))
45 $this->setData($parsed);