Browse Source

add api endpoint for POST /certificate/custom to upload custom cert

CauseFX 4 years ago
parent
commit
d4b105af6b
1 changed files with 11 additions and 0 deletions
  1. 11 0
      api/v2/routes/certificate.php

+ 11 - 0
api/v2/routes/certificate.php

@@ -0,0 +1,11 @@
+<?php
+$app->post('/certificate/custom', function ($request, $response, $args) {
+	$Organizr = ($request->getAttribute('Organizr')) ?? new Organizr();
+	if ($Organizr->qualifyRequest(1, true)) {
+		$Organizr->uploadCert();
+	}
+	$response->getBody()->write(jsonE($GLOBALS['api']));
+	return $response
+		->withHeader('Content-Type', 'application/json;charset=UTF-8')
+		->withStatus($GLOBALS['responseCode']);
+});