api - JSON request to create entity with existent inner object -


i develop rest api , think following task. need post vehicle entity , bind existing driver it. common approach format json such request? choose 1 of these variants, maybe there better solutions:

1. {"model":"corolla","number":"12345", "driver": {"id": 5}}  2. {"model":"corolla","number":"12345", "driver": {"id": 5, "name": "john"}}  3. {"model":"corolla","number":"12345", "driverid": 5}  

the question how pass information created driver entity known id.

according jsonapi, format :

{     "model":"corolla",     "number":"12345"     "links":     {         "driver": "5"     } } 

conventions defined in website may usefull you.


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -