0 Replies Latest reply on Nov 2, 2015 6:41 PM by Careau-Oracle

    Question on rest service creation with ords.define_* procedure

    Careau-Oracle

      Hi

      I'm creating a rest api using ORDS 3.0.2 and the package ORDS. ORDS is deployed in Weblogic 12c. (Not using APEX)

      I used the doc located on https://docs.oracle.com/cd/E56351_01/doc.30/e56293/ords_ref.htm#CACGGICG to create my rest call but I still have some unansered question...

      And I can't find any other web page with example on how to use it.

       

      - What's the utility to define multiple module with define_module ? I can create all rest call based on the same module or one module per call. Is one way have advantage on the others?

       

      - In the define_parameter, I can't understand how the p_bind_variable_name parameter works, does naybody can show me an example?

       

      - Does anybody have an example on how to retreive / use a parameter within my source SQL/PLSQL  when the source_type is set to 'HEADER' or 'RESPONSE' ?

       

      - Still in the define_parameter, with the p_access_method paramaeter, how can I set an output value and How the client retreive it ?


      Thanks

       

      There is an example on the code I created.

       

      declare

        lModule varchar2(50);

      begin

        lModule :=  'Call_11';

        ords.define_module(p_module_name => lModule, p_base_path => '/meta2/');

           

        ords.define_template(p_module_name => lModule, p_pattern => 'emp');

        ords.define_handler(p_module_name => lModule,

                            p_pattern =>  'emp',

                            p_method =>  'GET',

                            p_source_type => 'json/query',

                            p_source =>  'select e.* from emp3 e');

                         

      --------------------------------------------

        ords.define_template(p_module_name => lModule, p_pattern => 'emp/:empno');

        ords.define_handler(p_module_name => lModule,

                            p_pattern =>  'emp/:empno',

                            p_method =>  'GET',

                            p_source_type => 'json/query',

                            p_source =>  'select e.* from emp3 e where empno = :empno');

           

        ords.define_parameter(p_module_name     => lModule,

                              p_pattern         =>  'emp/:empno',

                              p_method         =>  'GET',

                              p_name           =>  'empNO' ,

                              p_bind_variable_name =>'empno',

                              p_source_type      =>'URI',

                              p_param_type        => 'INT',

                              p_access_method   =>'IN');

        commit;

      end;