Content Units¶
Retrieve a Single Unit¶
Returns information about a single content unit.
/pulp/api/v2/content/units/<content_type>/<unit_id>/
200 - if the unit is found
404 - if there is no unit at the given id
Sample 200 Response Body:
{
"_id": "046ca98d-5977-400d-b4de-a5bb57c8b7e2",
"_content_type_id": "type-2",
"_last_updated": "2013-09-05T17:49:41Z",
"_storage_path": "/var/lib/pulp/content/type-2/A",
"pulp_user_metadata": {},
"key-2a": "A",
"key-2b": "B",
}
Retrieve a Single Unit’s User Metadata¶
Returns the pulp_user_metadata field from a single content unit.
/pulp/api/v2/content/units/<content_type>/<unit_id>/pulp_user_metadata/
200 - if the unit is found
404 - if there is no unit at the given id
Sample 200 Response Body:
{
"user_key_1": "A",
"user_key_2": "B"
}
Set Single Unit’s User Metadata¶
Sets the pulp_user_metadata field on a single content unit to the provided values.
/pulp/api/v2/content/units/<content_type>/<unit_id>/pulp_user_metadata/
200 - if the unit is found
404 - if there is no unit at the given id
Sample Request:
{
"user_key_1": "A",
"user_key_2": "B"
}
Sample 200 Response Body:
null
Search for Units¶
Please see Search API for more details on how to perform these searches.
Returns information on content units in the Pulp server that match your search parameters. It is worth noting that this call will never return a 404; an empty array is returned in the case where there are no content units. This is even the case when the content type specified in the URL does not exist.
/pulp/api/v2/content/units/<content_type>/search/
criteria (object) - mapping structure as defined in Search Criteria
include_repos (boolean) - (optional) adds an extra per-unit attribute “repository_memberships” that lists IDs of repositories of which the unit is a member.
200 - containing the array of content units
Sample 200 Response Body:
[
{
"key-2a": "A",
"_ns": "units_type-2",
"_id": "046ca98d-5977-400d-b4de-a5bb57c8b7e2",
"pulp_user_metadata": {},
"key-2b": "A",
"_content_type_id": "type-2",
"repository_memberships": ["repo1", "repo2"]
},
{
"key-2a": "B",
"_ns": "units_type-2",
"_id": "2cc5b44a-c5d7-4751-9505-c54ad4f43497",
"pulp_user_metadata": {},
"key-2b": "C",
"_content_type_id": "type-2",
"repository_memberships": ["repo1"]
}
]
Returns information on content units in the Pulp server that match your search parameters. It is worth noting that this call will never return a 404; an empty array is returned in the case where there are no content units. This is even the case when the content type specified in the URL does not exist.
This method is slightly more limiting than the POST alternative, because some filter expressions may not be serializable as query parameters.
/pulp/api/v2/content/units/<content_type>/search/
include_repos (boolean) - (optional) adds an extra per-unit attribute “repository_memberships” that lists IDs of repositories of which the unit is a member.
200 - containing the array of content units
Sample 200 Response Body:
[
{
"key-2a": "A",
"_ns": "units_type-2",
"_id": "046ca98d-5977-400d-b4de-a5bb57c8b7e2",
"pulp_user_metadata": {},
"key-2b": "A",
"_content_type_id": "type-2",
"repository_memberships": ["repo1", "repo2"]
},
{
"key-2a": "B",
"_ns": "units_type-2",
"_id": "2cc5b44a-c5d7-4751-9505-c54ad4f43497",
"pulp_user_metadata": {},
"key-2b": "C",
"_content_type_id": "type-2",
"repository_memberships": ["repo1"]
}
]