49.23 SET_REQUEST_HEADERS Procedure

This procedure sets HTTP request headers (g_request_headers) for subsequent MAKE_REQUEST or MAKE_REST_REQUEST calls.

Syntax

APEX_WEB_SERVICE.SET_REQUEST_HEADERS (
    p_name_01            IN VARCHAR2,
    p_value_01           IN VARCHAR2,
    p_name_02            IN VARCHAR2 DEFAULT NULL,
    p_value_02           IN VARCHAR2 DEFAULT NULL,
    p_name_03            IN VARCHAR2 DEFAULT NULL,
    p_value_03           IN VARCHAR2 DEFAULT NULL,
    p_name_04            IN VARCHAR2 DEFAULT NULL,
    p_value_04           IN VARCHAR2 DEFAULT NULL,
    p_name_05            IN VARCHAR2 DEFAULT NULL,
    p_value_05           IN VARCHAR2 DEFAULT NULL,
    p_reset              IN BOOLEAN  DEFAULT TRUE,
    p_skip_if_exists     IN BOOLEAN  DEFAULT FALSE );

Parameters

Table 49-17 SET_REQUEST_HEADERS Parameters

Parameter Description
p_name_01 Name of the 1st parameter to set.
p_value_01 Value of the 1st parameter to set.
p_name_02 Name of the 2nd parameter to set.
p_value_02 Value of the 2nd parameter to set.
p_name_03 Name of the 3rd parameter to set.
p_value_03 Value of the 3rd parameter to set.
p_name_04 Name of the 4th parameter to set.
p_value_04 Value of the 4th parameter to set.
p_name_05 Name of the 5th parameter to set.
p_value_05 Value of the 5th parameter to set.
p_reset Whether to clear the request header array before.
p_skip_if_exists

If TRUE, any existing headers with the same name remain unchanged.

For example, if you pass in "Content-Type" as p_name_NN and that header is already present in the apex_web_services.g_request_headers array, then the value that you pass in does not override the existing header value for that name.

Example 1

The following example appends "Content-Type" and "User-Agent" HTTP request headers to the already existing headers, but only if they do not exist yet.

begin
    apex_web_service.set_request_headers(
        p_name_01        => 'Content-Type',
        p_value_01       => 'application/json',
        p_name_02        => 'User-Agent',
        p_value_02       => 'APEX',
        p_reset          => false,
        p_skip_if_exists => true );
end;

Example 2

The following example clears existing request headers and sets "Content-Type" and "User-Agent."

begin
    apex_web_service.set_request_headers(
        p_name_01        => 'Content-Type',
        p_value_01       => 'application/json',
        p_name_02        => 'User-Agent',
        p_value_02       => 'APEX' );
end;