aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/api/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'application/api/controllers')
-rw-r--r--application/api/controllers/Links.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/application/api/controllers/Links.php b/application/api/controllers/Links.php
index 1c68b062..a40e974d 100644
--- a/application/api/controllers/Links.php
+++ b/application/api/controllers/Links.php
@@ -188,4 +188,27 @@ class Links extends ApiController
188 $out = ApiUtils::formatLink($responseLink, $index); 188 $out = ApiUtils::formatLink($responseLink, $index);
189 return $response->withJson($out, 200, $this->jsonStyle); 189 return $response->withJson($out, 200, $this->jsonStyle);
190 } 190 }
191
192 /**
193 * Delete an existing link by its ID.
194 *
195 * @param Request $request Slim request.
196 * @param Response $response Slim response.
197 * @param array $args Path parameters. including the ID.
198 *
199 * @return Response response.
200 *
201 * @throws ApiLinkNotFoundException generating a 404 error.
202 */
203 public function deleteLink($request, $response, $args)
204 {
205 if (! isset($this->linkDb[$args['id']])) {
206 throw new ApiLinkNotFoundException();
207 }
208
209 unset($this->linkDb[(int) $args['id']]);
210 $this->linkDb->save($this->conf->get('resource.page_cache'));
211
212 return $response->withStatus(204);
213 }
191} 214}