mirror of
https://github.com/itflow-org/itflow
synced 2026-03-01 03:14:52 +00:00
Deduplicate API GET check into single file
This commit is contained in:
@@ -1,13 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
require('../validate_api_key.php');
|
require('../validate_api_key.php');
|
||||||
|
|
||||||
if($_SERVER['REQUEST_METHOD'] !== "GET"){
|
require('../require_get_method.php');
|
||||||
header("HTTP/1.1 405 Method Not Allowed");
|
|
||||||
$return_arr['success'] = "False";
|
|
||||||
$return_arr['message'] = "Can only send GET requests to this endpoint.";
|
|
||||||
echo json_encode($return_arr);
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Asset via ID (single)
|
// Asset via ID (single)
|
||||||
if(isset($_GET['asset_id'])){
|
if(isset($_GET['asset_id'])){
|
||||||
|
|||||||
@@ -1,13 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
require('../validate_api_key.php');
|
require('../validate_api_key.php');
|
||||||
|
|
||||||
if($_SERVER['REQUEST_METHOD'] !== "GET"){
|
require('../require_get_method.php');
|
||||||
header("HTTP/1.1 405 Method Not Allowed");
|
|
||||||
$return_arr['success'] = "False";
|
|
||||||
$return_arr['message'] = "Can only send GET requests to this endpoint.";
|
|
||||||
echo json_encode($return_arr);
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Specific certificate via ID (single)
|
// Specific certificate via ID (single)
|
||||||
if(isset($_GET['certificate_id'])){
|
if(isset($_GET['certificate_id'])){
|
||||||
|
|||||||
@@ -1,13 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
require('../validate_api_key.php');
|
require('../validate_api_key.php');
|
||||||
|
|
||||||
if($_SERVER['REQUEST_METHOD'] !== "GET"){
|
require('../require_get_method.php');
|
||||||
header("HTTP/1.1 405 Method Not Allowed");
|
|
||||||
$return_arr['success'] = "False";
|
|
||||||
$return_arr['message'] = "Can only send GET requests to this endpoint.";
|
|
||||||
echo json_encode($return_arr);
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Specific contact via ID (single)
|
// Specific contact via ID (single)
|
||||||
if(isset($_GET['contact_id'])){
|
if(isset($_GET['contact_id'])){
|
||||||
|
|||||||
@@ -1,13 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
require('../validate_api_key.php');
|
require('../validate_api_key.php');
|
||||||
|
|
||||||
if($_SERVER['REQUEST_METHOD'] !== "GET"){
|
require('../require_get_method.php');
|
||||||
header("HTTP/1.1 405 Method Not Allowed");
|
|
||||||
$return_arr['success'] = "False";
|
|
||||||
$return_arr['message'] = "Can only send GET requests to this endpoint.";
|
|
||||||
echo json_encode($return_arr);
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Specific domain via ID (single)
|
// Specific domain via ID (single)
|
||||||
if(isset($_GET['domain_id'])){
|
if(isset($_GET['domain_id'])){
|
||||||
|
|||||||
@@ -1,13 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
require('../validate_api_key.php');
|
require('../validate_api_key.php');
|
||||||
|
|
||||||
if($_SERVER['REQUEST_METHOD'] !== "GET"){
|
require('../require_get_method.php');
|
||||||
header("HTTP/1.1 405 Method Not Allowed");
|
|
||||||
$return_arr['success'] = "False";
|
|
||||||
$return_arr['message'] = "Can only send GET requests to this endpoint.";
|
|
||||||
echo json_encode($return_arr);
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Specific network via ID (single)
|
// Specific network via ID (single)
|
||||||
if(isset($_GET['network_id'])){
|
if(isset($_GET['network_id'])){
|
||||||
|
|||||||
8
api/v1/require_get_method.php
Normal file
8
api/v1/require_get_method.php
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
if($_SERVER['REQUEST_METHOD'] !== "GET"){
|
||||||
|
header("HTTP/1.1 405 Method Not Allowed");
|
||||||
|
$return_arr['success'] = "False";
|
||||||
|
$return_arr['message'] = "Can only send GET requests to this endpoint.";
|
||||||
|
echo json_encode($return_arr);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
@@ -1,13 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
require('../validate_api_key.php');
|
require('../validate_api_key.php');
|
||||||
|
|
||||||
if($_SERVER['REQUEST_METHOD'] !== "GET"){
|
require('../require_get_method.php');
|
||||||
header("HTTP/1.1 405 Method Not Allowed");
|
|
||||||
$return_arr['success'] = "False";
|
|
||||||
$return_arr['message'] = "Can only send GET requests to this endpoint.";
|
|
||||||
echo json_encode($return_arr);
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Specific software via ID (single)
|
// Specific software via ID (single)
|
||||||
if(isset($_GET['software_id'])){
|
if(isset($_GET['software_id'])){
|
||||||
|
|||||||
@@ -1,13 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
require('../validate_api_key.php');
|
require('../validate_api_key.php');
|
||||||
|
|
||||||
if($_SERVER['REQUEST_METHOD'] !== "GET"){
|
require('../require_get_method.php');
|
||||||
header("HTTP/1.1 405 Method Not Allowed");
|
|
||||||
$return_arr['success'] = "False";
|
|
||||||
$return_arr['message'] = "Can only send GET requests to this endpoint.";
|
|
||||||
echo json_encode($return_arr);
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Specific ticket via ID (single)
|
// Specific ticket via ID (single)
|
||||||
if(isset($_GET['ticket_id'])){
|
if(isset($_GET['ticket_id'])){
|
||||||
|
|||||||
Reference in New Issue
Block a user