2 Replies Latest reply on Dec 19, 2014 1:41 PM by partlycloudy

    PUT/POST examples


      Most of the  examples of using ORDS focus on retrieving data from Oracle using the HTTP GET handler. If I have a API with multiple IN parameters and multiple OUT parameters, how can I use ORDS to expose this via HTTP PUT/POST handler? What would the URI look like? Is there a step-by-step example?



        • 1. Re: PUT/POST examples
          Jeroen van Meenen



          you might try take a look at the oracle.example.hr  example in apex.oracle.com

          => SQL Workshop => RESTful Service Module


          The last Resource Handler called "empsecformat/{empname}"  is of type PL/SQL


          There you can call your API and maybe return your out parameters.


          I have used this successfully to call my own procedure and return output.



          • 2. Re: PUT/POST examples

            I am a little confused.


            1. The resource handler for empsecformat/{empname} has method GET and the source type is PL/SQL. But the help for the Source Type field says that PL/SQL can be used only when the method is PUT/POST/DELETE.


            2. Besides, it is not considered good practice for a GET method to modify data. PUT or POST should be used for that.


            3. The example shows how to return formatted HTML output. That's not what I am looking for. All I am looking for is a POST resource handler that maps to a PL/SQL API with IN and OUT parameters. Some of the IN parameters have DEFAULT values so the resource handler should be able to handle this. The web service should return a JSON object comprising the OUT parameters.


            How can this be done?