/** * Retrieve a collection * * @apiMethod GET * @apiUri /collections/{id} * @apiParameter { * "name": "id", * "description": "Blog entry identifier", * "type": "integer", * "required": true, * "default": null * } * @return void */ public function readTask() { $id = Request::getInt('id', 0); $row = new Collection($id); if (!$row->exists()) { throw new Exception(Lang::txt('COM_COLLECTIONS_ERROR_MISSING_RECORD'), 404); } $response = $row->toObject(); $response->created_by = new stdClass(); $response->created_by->id = $row->get('created_by'); $response->created_by->name = $row->creator()->get('name'); $response->url = str_replace('/api', '', rtrim(Request::base(), '/') . '/' . ltrim(Route::url($row->link()), '/')); $this->send($response); }