Skip to Main Content

ORDS, SODA & JSON in the Database

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Oracle ords: How to create put/post method with collection

f0ded90f-9dc9-4ab8-bdba-6981bef7b2f2Jan 18 2016 — edited Jan 20 2016

I created a post method to receive the geolocation data of customers:

post_method.png

When I call the post method with the JSON:

{"customer": 1, "latitude":-21.13179, "longitude":-47.736782 }

my PL/SQL Script works.

Now I'd like to send a group of records but I don't know how to do it. I created a PUT method to receive a collections of geolocations and I constructed a script just to parse the parameter:

put_method.png

When I call the put method with the JSON:

{ "items":[ { "customer":1, "latitude":-21.13179, "longitude":-47.736782 }, { "customer":1, "latitude":-21.13179, "longitude":-47.736782 } ] }

PL/SQL code:

declare

 `l_values apex_json.t_values;` 

begin

 `apex_json.parse ( p_values => l_values, p_source => :items );` 

end;

I received the message:

400 - Bad Request - Expected a value but got: START_ARRAY.

What I'm doing of wrong? I want to create a post/put method to receive a collection.

Thanks for your help.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 17 2016
Added on Jan 18 2016
1 comment
882 views