/** * Make an update request. * * @param array $data The data to update. * * @return mixed the result from the database (defined by $returnFields) */ public function update(array $data) { $path = "/" . $this->table; $path .= "/" . implode(",", $this->fields); $path .= "?"; if ($this->where) { $path .= "where=" . urlencode($this->where) . "&"; } $data['key'] = $this->wsConfig->getApiKey(); if ($this->returnFields) { $data['return'] = implode(",", $this->returnFields); } return $this->http->put($this->wsConfig->getUrl() . $path, $data); }
/** * Checks if the call to the webservice is made with a valid API key. * * @param string $apiKey The API key sent by the client. * * @return bool true if the key is correct, false otherwise */ public function checkAuth($apiKey) { $wsConfig = new DbWebserviceConfig(); return $wsConfig->getApiKey() === $apiKey; }