[Pulp-dev] Many-to-many joins in the API
daviddavis at redhat.com
Wed Oct 18 16:45:00 UTC 2017
Working on issue #3073 , 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 ). 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)
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)
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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Pulp-dev