10 ORDS_PAR PL/SQL Package Reference

The ORDS_PAR PL/SQL package contains subprograms (procedures and functions) for generating and revoking the pre-authenticated URLs in Oracle REST Data Services.

10.1 ORDS_PAR.DEFINE_FOR_HANDLER

Format

ORDS.DEFINE_FOR_HANDLER(
p_module_name      IN VARCHAR2,
p_pattern          IN VARCHAR2,
p_method           IN VARCHAR2,
p_duration IN NUMBER
);

Description

DEFINE_FOR_HANDLER function is used to create a PAR for a RESTful service handler. The PAR is valid only in the context of a current REST-enabled schema.

Parameters

p_module_name

Specifies the name of the existing RESTful service module. This parameter value is case sensitive.

p_pattern

Specifies the matching pattern for an existing resource template.

p_method

Specifies the HTTP method of the existing handler. Valid values are GET, POST, PUT, or DELETE.

p_duration

Duration in seconds for which the PAR is valid.

Example

The following example, creates a PAR URL for an existing handler in the ordstest enabled schema.
set serveroutput on
DECLARE
  l_uri clob;
BEGIN
   l_uri := ORDS_PAR.DEFINE_FOR_HANDLER(
    p_module_name => 'demo',
    p_pattern => 'emp/',
    p_method => 'GET',
    p_duration => 360
  );
  
  COMMIT;

  DBMS_OUTPUT.PUT_LINE(l_uri);
END;
/

-- Prints
{
 "token": "<par_token>",
 "alias" : "<par_alias>",
 "uri": "ordstest/_/par/"<par_token>/demo_prefix/emp/"
}

10.2 ORDS_PAR.REVOKE_PAR

Format

ORDS_PAR.REVOKE_PAR(
p_par_token      IN VARCHAR2
);

Description

REVOKE_PAR function revokes an existing PAR in the current schema. It may take up to 30 seconds for the changes to take effect.

Parameters

p_par_token

Specifies the token to be revoked. It can be extracted from the URI returned when the PAR was created.

Example

The following example revokes an existing PAR in the current schema:
BEGIN
   ORDS_PAR.REVOKE_PAR(
    p_par_token => '<par_token>');
  COMMIT;
END;
/