Anton Nielsen
apex_debug

Follow

apex_debug

Follow
ORDS Quirks - slashes and feeds

ORDS Quirks - slashes and feeds

Anton Nielsen's photo
Anton Nielsen
·Jan 4, 2017·

2 min read

Returning to the stated purpose of this blog, "specific solutions to isolated problems," I've run into a few quirks with Oracle REST Data Services recently. The first is simply figuring out exactly what version of ORDS I am running. There are (at least) two components, the mid-tier java (ords.war) and the database metadata and packages (in ORDS_METADATA). Does anyone know the best way to get these? (Edit: See comments for answer to this.)

Next, I've run into quirks around exactly where to put slashes. In an earlier post (c2anton.blogspot.com/2016/06/super-quick-or..) I demonstrated how to use the APIs to create ORDS modules, templates and handlers. I tried to use the exact commands in a newer ORDS version and ran into issues when using bind variables. I kept getting THE "ORACLE REST DATA SERVICES" banner along with "404 not found" whenever I created a template and handler with a bind variable.

This used to work:

  1. begin ORDS.DEFINE_MODULE(
    p_module_name => 'antonModule',
    p_base_path => '/antonmodule',
    p_items_per_page => 25,
    p_status => 'PUBLISHED',
    p_comments => NULL );

    commit;
    end;

begin
ORDS.DEFINE_TEMPLATE(
p_module_name => 'antonModule',
p_pattern => '/sqltest/{abc}/{def}',
p_priority => 0,
p_etag_type => 'HASH',
p_etag_query => NULL,
p_comments => NULL );

commit;
end;

But in the new version I have to put a trailing slash in define_module ( p_base_path => '/antonmodule/' ) and remove it from the beginning of p_pattern in define_template ( p_pattern => 'sqltest/{abc}/{def}' ).

It took my more time that I wish to admit to figure that out.

*****************************

The next issue is with the feed handler. The feed should create a $ref of this format

mymachine/ords/myuser/mymodule/myfeed{uid}

but it is creating this
mymachine/ords/myuser/mymodule{uid}

Maybe I just need to upgrade (edit: I upgraded to latest ORDS, 3.0.9. I still have the same issues.), but yikes, these two issues have made for a long day today. Hopefully this helps someone spend a little less time on this than I did :)

 
Share this