Collections functions
General functions
Node functions
Render functions
Theme permission functions
User functions
Resource functions

api_assert_post_request()

Description

Assert API request is using POST method.

Parameters

ColumnTypeDefaultDescription
array :

Return

array Returns JSend data back {@see ajax_functions.php} if not POST method

Location

include/api_functions.php lines 462 to 472

Definition

 
function api_assert_post_request(): array
    {
    
// Applicable only to native authmode to limit BC only for the ResourceSpace UI (which is using this mode)
    
if (!defined('API_AUTHMODE_NATIVE') || $_SERVER['REQUEST_METHOD'] === 'POST')
        {
        return [];
        }

    
http_response_code(405);
    return 
ajax_response_fail(ajax_build_message($GLOBALS['lang']['error-method-not_allowed']));
    }

This article was last updated 15th August 2023 17:05 Europe/London time based on the source file dated 6th June 2023 11:10 Europe/London time.