[Pulp-dev] Plan to handle ids and hrefs

David Davis daviddavis at redhat.com
Wed Aug 8 16:02:41 UTC 2018


After recent meetings with stakeholders, we've arrived at a solution on how
to handle ids and hrefs in the Pulp 3 API. The plan is to stop accepting
hrefs for fields to instead rely solely on IDs. Hrefs will still be
displayed in the API as a convenience to users but will not be accepted for
fields in POST/PUT requests.

In order to support polymorphic fields, we'll also be adding a 'type' field
that will be returned for all objects that will contain the package name
and resource name (e.g. pulp_file.FileContent). This will allow these
objects to be posted to polymorphic fields like
add_content_units/remove_content_units (see below).

Lastly, we also propose un-nesting the repository versions endpont and
making it a top-level resources. Filtering of repository versions
associated with a specific repo will be handled by repo filters, e.g.
/pulp/api/v3/repository_versions/?repository=3


RETURNING DATA

Return for all objects:
- id
- _href
- type

e.g. {'id': 4, 'type': 'pulp_file.FileContent', '_href': '
http://localhost:8000/pulp/api/v3/content/file/files/4/'}

This includes polymorphic fields (e.g. created_resource on TaskStatus)


POSTING DATA

Submitting data in general will use id only (no hrefs). For example:

http http://localhost:8000/pulp/api/v3/remotes/file/3/sync repository=3

Submitting polymorphic fields can be handled in the following way:

add_content_units=[
    {'id': 4, 'type': 'pulp_file.FileContent', '_href': '
http://localhost:8000/pulp/api/v3/content/file/files/4/'},
    {'id': 4, 'type': 'pulp_python.PythonContent', '_href': '
http://localhost:8000/pulp/api/v3/content/python/p/4/'}
]

Note: the only fields that are inspected are id and type. the rest are
ignored. This simply allows users to pass back the data they receive from
the content endpoint.


We're holding off on proceeding until August 15th to allow time for
comment. Please respond with any concerns or feedback before then.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/pulp-dev/attachments/20180808/3f5aef77/attachment.htm>


More information about the Pulp-dev mailing list