Skip to content
Advertisement

post data for foreign key in postman

JavaScript

this is my model class.There is foreign key from another table AssessmentProperties .now when iam posting the data with postman my data looks like this

JavaScript

but my input should be looking like this

JavaScript

can anyone say me what should i do for this? and by the way this is the controller for post method

JavaScript

Advertisement

Answer

Instead of using SectionProperties as @RequestBody param, make a custom DTO (DataTransferObject) class that will look like this in JSON format:

JavaScript

And like this in POJO:

JavaScript

Then your method should look like this, note that you will have to change your logic to convert from DTO object into entity and vice versea:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement