[Pulp-dev] Many-to-many joins in the API

David Davis daviddavis at redhat.com
Wed Oct 18 16:45:00 UTC 2017

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.

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:

POST /api/v3/repositorycontents/ (which takes a repo id and content id)
DELETE /api/v3/repositorycontents/<repo-content-id>/

We would have to start exposing the repo content id in the api to get this
second link working.

However, alternatively, we could use a nested route to handle
adding/removing repo contents:

POST /api/v3/repositories/<repo-id>/content/ (which takes a content id)
DELETE /api/v3/repositories/<repo-id>/content/<content-id>/

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.


[1] https://pulp.plan.io/issues/3073
[2] https://pulp.plan.io/issues/2873

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/pulp-dev/attachments/20171018/47526447/attachment.htm>

More information about the Pulp-dev mailing list