oracle-databaseoracle-ords

Oracle ORDS REST modules - optional parameters in handler


To create a handler, it seems that I would need to create a template with a URI template to create bindings.

However, the bindings seem to me only possible as a path structure (e.g. /:id/:records/:department) instead of being searchParams (?id=1&department=IT)

How could I allow optional parameters in the URL for handlers?


Solution

  • You can access search params variables just as you would access it in the URL template. There's no need to strictly define all possible input parameters in the URL template.

    You can use binds or parameters, or even a mix.

    I have full code examples here.

    Run the sql's...

    enter image description here

    Confirm your APIs have been created, and call the API...

    In this case a

    GET http://localhost:8080/ords/hr/parameters/headers-classic?id=4
    

    enter image description here