Andres
Andres

Reputation: 10707

Spring Data Rest, Many to one

I'm building an application using Spring Data Rest. i have a Many to One relationship backed by a non-nullable foreign key. Which is the correct way to add an element on the "Many" side of the relationship using the REST API?

Upvotes: 1

Views: 2698

Answers (1)

Andres
Andres

Reputation: 10707

This happened to work:

POST http://server:8080/context/manyEntity

{"manyId":"manyIdValue","manyAttribute1":"manyAttribute1Value",...,"oneEntity":{"oneId":"oneIdValue"}}

Upvotes: 2

Related Questions