[Pulp-dev] Proposal and feedback request: un-nest urls

Austin Macdonald amacdona at redhat.com
Fri Dec 1 03:49:05 UTC 2017


I have a first-draft of the POC https://github.com/pulp/pulp/pull/3232

On Thu, Nov 30, 2017 at 6:23 PM, Jeremy Audet <jaudet at redhat.com> wrote:

> For deletes, the db relationships are all there, so I expect deletes to
>>> cascade to other objects with any url
>>> structure. I believe closer to the release, we'll have to look at the
>>> cascading delete relationships to see if
>>> the behaviors that we have are correct.
>>>
>>> Overall, I'm +1 on un-nesting. I think it would result in a good user
>>> experience. I know it goes against the
>>> logical composition arguments, which have been well laid out. We want
>>> Pulp to be really simple, and the nested
>>> URL in the top of this thread is anything but simple. Consider another
>>> project like Ansible Galaxy (who also
>>> uses Django and DRF). Their API is very flat and as an outsider I find
>>> it very approachable:
>>> https://galaxy.ansible.com/api/v1/  Pulp could be that simple.
>>>
>>
>> Clicking through the Galaxy API, there seems to be a good bit of nesting.
>
>
> There is. Let me be explicit. Here's some of the available URLs:
>
>    - /api/v1/notifications/
>    - /api/v1/notifications/120165/imports/
>    - /api/v1/imports/
>    - /api/v1/imports/166952/notifications/
>
> A simple call to the repository gives hrefs for importers and publishers,
so I think we are covered.
Example from POC:

GET /api/v3/repositories/a6287821-5d13-4a59-8a34-a7ea98bcc40d/


Response:
{
    "_href": "
http://pulp3.dev:8000/api/v3/repositories/a6287821-5d13-4a59-8a34-a7ea98bcc40d/
",
    "name": "test",
    "description": "",
    "notes": {},
    "last_content_added": null,
    "last_content_removed": null,
    "importers": [
        "http://pulp3.dev:8000/api/v3/importers/file/testi/"
 <--------------------<
    ],
    "publishers": [
       "http://pulp3.dev:8000/api/v3/publishers/file/testp/",
<----------------------<
        "http://pulp3.dev:8000/api/v3/publishers/file/sdfdsffd/"
    ],
    "content": "
http://pulp3.dev:8000/api/v3/repositories/a6287821-5d13-4a59-8a34-a7ea98bcc40d/content/
",
    "content_summary": {}
}

It seems a little redundant, but we could also add "detail routes" to the
repository (and/or importers/publishers) that would add these endpoints.
(We would need to decide if we cast() or if we add <type> to the endpoint.)

v3/repositories/<id>/importers/
v3/repositories/<id>/publishers/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/pulp-dev/attachments/20171130/6588b2a9/attachment.htm>


More information about the Pulp-dev mailing list