2

I am using Backand BaaS for my ionic app. My model consists of two tables: 1. Users 2. Trips

A one-to-many relationship has been established between 'Users' and 'Trips'.

'Users' has a collection field that is a collection of 'Trips' and 'Trips' has a owner field that is an object of 'Users'.

What is the correct way to create an object so that upon creating I am assigning the correct owner ('Users' object) to 'Trips' collection field ?

Vince
  • 691
  • 1
  • 8
  • 18

1 Answers1

3

When POSTing a new Trip use this for the Trip Object

{
tripName:"asdf"
owner:1
}

In the users object it will look like this

{
id:1
fName:"david"
trips:[{__metadata: {id: 1}, tripName: "asdf"}]
}
user3375230
  • 421
  • 2
  • 5