Forum Stats

  • 3,750,404 Users
  • 2,250,174 Discussions
  • 7,866,968 Comments

Discussions

Is Oracle ORDS support PATCH method ?

haidarvm
haidarvm Member Posts: 1

I run ORCLE ORDS via POSTMAN or Curl but always error on using PATCH

curl -H "Content-Type: application/json"  --data '{"customer_id" : 2, "address" : "new street"}' -X PATCH https://example.com/ords/address/59

but it's return to

pastedImage_0.pngREST Data Services

405 Method Not Allowed

Answers

  • thatJeffSmith-Oracle
    thatJeffSmith-Oracle Distinguished Product Manager Posts: 7,906 Employee
    edited Sep 24, 2019 8:16AM

    we currently support GET, POST, PUT, and DELETE

  • User_K7DQO
    User_K7DQO Member Posts: 2 Green Ribbon

    So, it means, if, I have to update only 2 columns in a record having 186 columns, I need to pass all the column values (except primary key columns, which shall be part of URL parameters).

    Any suggested workaround for this??

  • thatJeffSmith-Oracle
    thatJeffSmith-Oracle Distinguished Product Manager Posts: 7,906 Employee

    Or build an API that sorts the update for you - your POST or PUT will run whatever SQL/PLSQL you tell it to.

  • User_K7DQO
    User_K7DQO Member Posts: 2 Green Ribbon
    edited Sep 2, 2021 1:31PM

    @thatJeffSmith-Oracle I understand what you said. But, PUT cannot replace PATCH in our case. Though, we can use Dynamic SQL to update one column-value pair, I believe. But;

    1) This will need extra effort to check and validate the data type of column/attribute value.

    2) When there are more than 1 columns updated, we have to have same number of PUT requests to be made. Since, we need to consider all the combinations of columns getting updated. At the client side/front end, we can easily parse the fields/column being updated (except primary key attribute/s, of course) and can generate/send the json to backend API/endpoint accordingly.

    The only solution, for us is to adhere to the PUT method specifications (Update/replace the entire record/object).

    I think, true RESTFul API is should implement all methods.