UPDATE 09/06/2018
My models looks like this:
public class Activity
{
public int Id { get; set; }
public List<Additive> Additives { get; set; }
}
public class Additive
{
public int Id { get; set; }
public int ActivityId { get; set; }
public Activity Activity { get; set; }
}
Original Question
I'm developing a RESTful API and i want to do it the cleanest way possible.
Currently i'm working on data retrieving. So i got this
If i create a new resource called activity and it has an array of objects, lets say (hardcoded, not representative):
{
"name": "act1",
"objects": [
{ "obj1":"val1" },
{ "obj2":"val2" }]
}
I'll could add or delete objects from my array.
Now, my question is, if i want to access them with an url like this:
Api/activity/1/objects/2
Which is the correct way to tell MySQL that this object is my 2th object of the list?
Or maybe i should select ALL objects of Act1 on the backend and filter them to retrieve just the 2th one.