I have a RESTful Service that accepts a bind value to a query that ORDS will run for me.

How do I pass that bind to ORDS?

You can do it explicitly be defining it as part of the URI.

Or, you can use the classic web ?var=value to pass it.

ORDS supports both 🙂

Both Services run the same SQL

The only difference is the URI itself.

So how do I pass the ID on the simpler URI?

Easy, just include it on the call.

pass things in as needed/required

So, which one to use? I imagine it’s a matter of personal preference. For me the former seems more COLLECTION/RESOURCE-RESTy, and the latter seems more flexible.

Author

I'm a Distinguished Product Manager at Oracle. My mission is to help you and your company be more efficient with our database tools.

7 Comments

  1. Thx. But how can I specify that a parameter is mandatory for the generated swagger? It seems that URI parameters are mandatory in swagger (obvious), put QUERY parameters are always optional.

  2. This is very helpful. Per the note above, if additional parameters are added with an &, ORDS creates bind variables automatically.

    However, upon doing the following I see a 400 bad request error.
    ords/schema_name/other_text?parameter1=12&limit=10

    If I remove ‘limit’, this works. Even if I change the parameter to “Limit” it works. Is there a way to use this URI with the parameter ‘limit’? I am on APEX 20.1 Thanks in advance for your help!

    • limit is a reserved word, change it to something else if you’re going to use it as a parameter

      ‘Get Table Data Using Paging
      This example specifies the offset and limit parameters to control paging of result
      data.
      Pattern: GET http://:/ords///?
      offset=&limit= Example: GET http://localhost:8080/ords/ordstest/emp/?offset=10&limit=5

      I have a SQL based GET handler, and if I call it, i only get 2 records
      http://localhost:8080/ords/hr/eco/employees/rich?limit=2

      But i can’t have a parameter named ‘limit’ – it’s reserved.

  3. Ahmed Haroon Reply

    hi, please guide me for Template URI with multiple bind variables the correct syntax
    uri/:p_id
    how i can add more bind variables? i am using oracle apex interface SQL Workshop -> RESTful Services
    thanks n regards

  4. Thanx man. You saved my life after migrating to Apex 18 from 4.2. I cannot change other external application behavior with REST calls with “old style” URI templates and I was terrified after getting “URI Template may contain only alphabetic, numeric, underscore, dash, period, and forward slash characters, or may contain a single trailing asterisk.” message from REST modules designer… Now I know how to design them I can still use “old style” URI call 🙂

Write A Comment