Using the Security API Package During Development

You must call a security API, CDR_PUB_API_INITIALIZATION, from every package that calls an Oracle Life Sciences Data Hub API and that you intend to run from outside Oracle LSH.

This API contains three functions:

  • EnableApis sets the EnableAPIs flag to True.
  • DisableApis sets the EnableAPIs flag to False.
  • AreApisEnabled returns the flag setting.

The initialization of almost every API calls the AreApisEnabled function of the security API, CDR_PUB_API_INITIALIZATION, to check if the EnableAPIs flag is set to True in the calling program. If EnableAPIs set to False, the initialization fails.

To set the EnableApis flag to True, your user account must have Execute privileges on the CDR_PUB_API_INITIALIZATION API.

  1. Begin the body with the following code to call the function to enable APIs:

    call cdr_pub_api_initialization.enableApis (arguments);

    The arguments are described in cdr_pub_api_initialization itself.

  2. At the end of the body, disable APIs to force the security check on the schema the next time the program is run:

    cdr_pub_api_intialization.disableApis (arguments);

Package A: Package A is always run outside of Oracle LSH. Therefore you need to call EnableApis at the beginning of your package body and call DisableAPIs at the end.

Package B: You develop Package B outside of Oracle LSH, so you must call EnableApis at the beginning of the package body and call DisableAPIs at the end. However, you upload Package B to a Program inside an Oracle LSH Adapter Area and the adapter calls the functions and procedures and runs them inside Oracle LSH. Packages that call CDR_PUB_API_INITIALIZATION from within Oracle LSH fail.

Therefore, if you call public APIs from Package B, you must call EnableApis and DisableApis so that you can run the package outside Oracle LSH, but when you are ready to upload the code to Oracle LSH, you must comment out the calls.

You may well want to use public APIs in your custom functions and procedures. For example, if you allow users to upload Table Columns during Load Set definition, you can take advantage of the public API for creating Table Descriptors as part of the upload_table_columns function.