Discussions
Categories
- 196.8K All Categories
- 2.2K Data
- 238 Big Data Appliance
- 1.9K Data Science
- 450.2K Databases
- 221.7K General Database Discussions
- 3.8K Java and JavaScript in the Database
- 31 Multilingual Engine
- 550 MySQL Community Space
- 478 NoSQL Database
- 7.9K Oracle Database Express Edition (XE)
- 3K ORDS, SODA & JSON in the Database
- 544 SQLcl
- 4K SQL Developer Data Modeler
- 187K SQL & PL/SQL
- 21.3K SQL Developer
- 295.8K Development
- 17 Developer Projects
- 138 Programming Languages
- 292.5K Development Tools
- 107 DevOps
- 3.1K QA/Testing
- 646K Java
- 28 Java Learning Subscription
- 37K Database Connectivity
- 154 Java Community Process
- 105 Java 25
- 22.1K Java APIs
- 138.1K Java Development Tools
- 165.3K Java EE (Java Enterprise Edition)
- 18 Java Essentials
- 160 Java 8 Questions
- 86K Java Programming
- 80 Java Puzzle Ball
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 94.3K Java SE
- 13.8K Java Security
- 204 Java User Groups
- 24 JavaScript - Nashorn
- Programs
- 437 LiveLabs
- 38 Workshops
- 10.2K Software
- 6.7K Berkeley DB Family
- 3.5K JHeadstart
- 5.7K Other Languages
- 2.3K Chinese
- 171 Deutsche Oracle Community
- 1.1K Español
- 1.9K Japanese
- 232 Portuguese
Response for a successful complex POST request
Hi,
I'm quite new to services. This question is about good practices, more than specific ords. Sorry if it is not good place.
We're setting up a REST service to insert a master-detail bunch of data in a single operation.
For example, imagine they send us info of a batch of boxes containing objects in a single json. Each box has its general properties, and the objects contained have their own properties each.
In your examples I've seen you always return the resource representation of the created entity after a post request, with the data received plus the generated id and any other metadata. That looks nice for a single box ... but in this case ... isn't it too much?
Wouldn't it be better to return a collection of single-box location headers?
We also have to decide what to do if one of the boxed object's properties fails in validation. We probably invalidate the whole box but let the other boxes pass and get created. If this behaviour is acceptable, I suppose we should return a collection indicating which boxes passed (and their locator) and which ones returned errors at box level or object level.
Best Answer
-
Hi,
The REST imply some conventions like returning the new data after POST/PUT so the client can display or validate its action.
But.... if you manage both the client code and the server code, you can set you own response policy.
Its completely up to you.
When working with external partners or tools you should try to stick to standards.
Regards,
Hadar
Answers
-
Hi,
The REST imply some conventions like returning the new data after POST/PUT so the client can display or validate its action.
But.... if you manage both the client code and the server code, you can set you own response policy.
Its completely up to you.
When working with external partners or tools you should try to stick to standards.
Regards,
Hadar
-
Well, I was afraid the response were too big to be operative, but now I believe the response is paginated, so I supose I should stick to the standard.
-
You can set the pagination size if you need