<div dir="ltr">Working on issue #3073 [1], there was a discussion that came up about how to best handle updating many-to-many joins in the API. We currently have a many-to-many relationship between repositories and contents which is handled by a RepositoryContent model. The api for this model is at /api/v3/repositorycontents/ (more info here [2]). But we also have an API already at /api/v3/repository/<repo-id>/content as well but it currently only lists the contents for a repository.<div><br></div><div>I think there are two options for supporting many-to-many joins in the API. First, we could continue to expose the join model and have routes like:</div><div><br></div><div>POST /api/v3/repositorycontents/ (which takes a repo id and content id)</div><div>DELETE /api/v3/repositorycontents/<repo-content-id>/</div><div><br></div><div>We would have to start exposing the repo content id in the api to get this second link working.</div><div><br></div><div>However, alternatively, we could use a nested route to handle adding/removing repo contents:</div><div><br></div><div>POST /api/v3/repositories/<repo-id>/content/ (which takes a content id)</div><div>DELETE /api/v3/repositories/<repo-id>/content/<content-id>/</div><div><br></div><div>This second scheme would essentially hide the RepositoryContent model from API users. I am not sure if that’s a good thing or a bad thing.</div><div><br></div><div>Thoughts?<br><div><div><br></div><div>[1] <a href="https://pulp.plan.io/issues/3073">https://pulp.plan.io/issues/3073</a><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>[2] <a href="https://pulp.plan.io/issues/2873" target="_blank" style="font-size:12.800000190734863px">https://pulp.plan.io/issues/<wbr>2873</a></div><div><br></div><div>David<br></div></div></div></div></div></div></div></div>
</div></div></div></div>