21.22 INITIALIZE_OUTPUT Procedure
This procedure initializes the output interface. You only have to call this procedure if you want to modify the parameters below. Initially, output is already configured with the defaults mentioned in the parameter table.
Syntax
APEX_JSON.INITIALIZE_OUTPUT (
p_http_header IN BOOLEAN DEFAULT TRUE,
p_http_cache IN BOOLEAN DEFAULT FALSE,
p_http_cache_etag IN VARCHAR2 DEFAULT NULL,
p_indent IN PLS_INTEGER DEFAULT NULL );
Parameters
Table 21-26 INITIALIZE_OUTPUT Procedure Parameters
Parameter | Description |
---|---|
|
If TRUE (the default), write an application/JSON mime type header. |
|
This parameter is only relevant if |
|
If not null, writes an |
|
Indent level. Defaults to 2, if debug is turned on, otherwise defaults to 0. |
Example
This example configures APEX_JSON
to not emit default headers, because they are written directly.
BEGIN
apex_json.initialize_output (
p_http_header => false );
sys.owa_util.mime_header('application/json', false);
sys.owa_util.status_line(429, 'Too Many Requests');
sys.owa_util.http_header_close;
--
apex_json.open_object;
apex_json.write('maxRequestsPerSecond', 10);
apex_json.close_object;
END;
Parent topic: APEX_JSON