3 Replies Latest reply on Oct 31, 2018 11:58 AM by Pierre Yotti

    Terminating /

    Filip Huysmans

      Hello,

       

      apparently ORDS is putting a terminating slash at the end of the get uri.

      Oracle PCS is not too happy about that.  Is there a way to remove the terminating '/'?

       

      Thx

       

      Filip Huysmans

      ORDS Version: 3.0.6.176.08.46

        • 1. Re: Terminating /
          Pierre Yotti

          Filip Huysmans

          I don't agree it. How did you create your Module. Can you give mode Details or can you export a sample module and post the code here. Here is for example my oj Module with a articles uri Template and that give me that Get Ressource.

           

          https://apex.oracle.com/pls/apex/pierrealli/v2/oj/articles

          Bildschirmfoto 2018-10-31 um 11.11.54.png

           

          Bildschirmfoto 2018-10-31 um 11.16.06.png

           

          Bildschirmfoto 2018-10-31 um 11.15.53.png

           

          By the way I will suggest you to migrate to ORDS 18.3. In 18.3 lots of thing have been fixed/ added/ performance speed up.

          • 2. Re: Terminating /
            Filip Huysmans

            Hi Alli,

            thx a lot for your feedback.

            I'm not using APEX, only ORDS.

            This is the script I'm using:

             

            BEGIN

             

            ords.delete_module(

            p_module_name => 'ctb_apps.assets.types'

            );


            ords.define_module(

            p_module_name => 'ctb_apps.assets.types'

            ,p_base_path => '/ctb_apps/asset_types/'

            ,p_comments => 'Module for all assets types'

            );


            ORDS.define_service(

            p_module_name => 'ctb_apps.assets.types',

            p_base_path => 'asset_types',

            p_pattern => '/',

            p_method => 'GET',

            p_source_type => ORDS.source_type_collection_feed,

            p_source => 'SELECT id, label FROM ctb_asset_types',

            p_items_per_page => 100);


            COMMIT;

            END;

            /

            • 3. Re: Terminating /
              Pierre Yotti

              Yes that is ORDS Webservices.

               

              You should give a URI- Muster Name. In your case you give "/" that is not good and not recommended.

               

              That is good  for ORDS 18.1

               

              -- Generated by Oracle SQL Developer REST Data Services 18.1.0.095.1630

              -- Exported REST Definitions from ORDS Schema Version 18.1.1.95.1251

              -- Schema: WS_USER   Date: Wed Oct 31 12:49:11 CET 2018

              --

              BEGIN

                ORDS.DEFINE_MODULE(

                    p_module_name    => 'ctb_apps.assets.types',

                    p_base_path      => '/asset_types/',

                    p_items_per_page =>  100,

                    p_status         => 'PUBLISHED',

                    p_comments       => NULL); 

                ORDS.DEFINE_TEMPLATE(

                    p_module_name    => 'ctb_apps.assets.types',

                    p_pattern        => 'test',

                    p_priority       => 0,

                    p_etag_type      => 'HASH',

                    p_etag_query     => NULL,

                    p_comments       => NULL);

                ORDS.DEFINE_HANDLER(

                    p_module_name    => 'ctb_apps.assets.types',

                    p_pattern        => 'test',

                    p_method         => 'GET',

                    p_source_type    => 'json/collection',

                    p_items_per_page =>  0,

                    p_mimes_allowed  => '',

                    p_comments       => NULL,

                    p_source         =>

              'SELECT * from dual'

                    );

               

                COMMIT;

              END;

               

               

              - For ORDS 3.x

               

              begin

                  ords.delete_module(p_module_name   => 'ctb_apps.assets.types');

                  ords.define_module(

                      p_module_name   => 'ctb_apps.assets.types',

                      p_base_path     => '/ctb_apps/asset_types/',

                      p_comments      => 'Module for all assets types'

                  );

               

               

                  ords.define_service(

                      p_module_name      => 'ctb_apps.assets.types',

                      p_base_path        => 'asset_types',

                      p_pattern          => 'test',-- you should do something like that

                      p_method           => 'GET',

                      p_source_type      => ords.source_type_collection_feed,

                      p_source           => 'SELECT id, label FROM ctb_asset_types',

                      p_items_per_page   => 100

                  );

                  commit;

              end;

              /

               

              Bildschirmfoto 2018-10-31 um 12.54.46.png

               

              Bildschirmfoto 2018-10-31 um 12.55.25.png

               

               

              You should understand how to design Rest services

              https://hackernoon.com/restful-api-design-step-by-step-guide-2f2c9f9fcdbf

              https://restfulapi.net/rest-api-design-tutorial-with-example/

               

               

              http://localhost:8080/ords/api/asset_types/test

               

               

              - asset_type: is the Module Name

              - test is the Get ressouse name