Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test 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.