public function restCall($path = '/', $method = 'GET', $postData = null, $failOnError = true)
{
$content = $this->call($path, $method, $postData);
$data = json_decode($content, true);
if ($failOnError && (!is_array($data) || @$data['error'])) {
$this->fail("path {$path}, method: {$method}:\n" . var_export($content, true));
}
return !json_last_error() ? $data : $content;
}