7 Oracle REST Data Services Administration PL/SQL Package Reference

The Oracle REST Data Services (ORDS) ADMIN PL/SQL package contains subprograms (procedures and functions) for developing and administering the RESTful services using Oracle REST Data Services for a privileged user.

Any user who has the execution rights on the ORDS_ADMIN package is considered to be an administrator. The predefined database role, ORDS_ADMINISTRATOR_ROLE is provided for this purpose.

The ORDS_ADMIN package is identical to the ORDS package except for the AUTHID CURRENT_USER right, without the deprecated methods and a p_schema parameter for every method where the target schema must be specified.

7.1 Example Subprograms for Developing and Administering RESTful Services

This section provides example subprograms that are used for developing and administering the RESTful services using ORDS.

Following are some of the example subprograms:

Example 7-1 ORDS_ADMIN.CREATE_ROLE

Format

ORDS_ADMIN.CREATE_ROLE(
   p_schema    IN ords_schemas.parsing_schema%type,
   p_role_name IN sec_roles.name%type);

The following example creates a role:

ORDS_ADMIN.CREATE_ROLE(
   p_schema    IN ords_schemas.parsing_schema%type,
   p_role_name IN sec_roles.name%type);

BEGIN
  ORDS_ADMIN.CREATE_ROLE(
    p_schema => 'tickets',
    p_role_name => 'Tickets User');
  };
END;
/

Example 7-2 ORDS_ADMIN.DEFINE_PARAMETER

Format

ORDS_ADMIN.DEFINE_PARAMETER(
   p_schema             IN ords_schemas.parsing_schema%type,
   p_module_name        IN ords_modules.name%type,
   p_pattern            IN ords_templates.uri_template%type,
   p_method             IN ords_handlers.method%type,
   p_name               IN ords_parameters.name%type ,
   p_bind_variable_name IN ords_parameters.bind_variable_name%type 
                              DEFAULT NULL,
   p_source_type        IN ords_parameters.source_type%type DEFAULT 'HEADER',
   p_param_type         IN ords_parameters.param_type%type DEFAULT 'STRING',
   p_access_method      IN ords_parameters.access_method%type DEFAULT 'IN',
   p_comments           IN ords_parameters.comments%type DEFAULT NULL);

The following example defines an outbound parameter on the POST handler to store the location of the created ticket:

BEGIN
  ORDS_ADMIN.DEFINE_PARAMETER(
    p_schema => 'tickets',
    p_module_name => 'my.tickets',
    p_pattern => '.',
    p_method => 'POST',
    p_name => 'X-APEX-FORWARD',
    p_bind_variable_name => 'location',
    p_source_type => 'HEADER',
    p_access_method => 'OUT'
  );
END;
/

Table 7-1 p-schema Parameter Description

Parameter Description
p_schema Specifies the name of the schema. This parameter is mandatory.