Bug 1064934

Summary: _href not present in the response body when single unit retrieval is done
Product: [Retired] Pulp Reporter: Ina Panova <ipanova>
Component: API/integrationAssignee: pulp-bugs
Status: CLOSED UPSTREAM QA Contact: pulp-qe-list
Severity: unspecified Docs Contact:
Priority: medium    
Version: unspecifiedCC: skarmark
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-02-28 22:02:35 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ina Panova 2014-02-13 15:13:48 UTC
Description of problem:
There is a discrepancy in response body while doing retrieval of different resource type.
For example when doing retrieval of single unit https://pulp-dev-guide.readthedocs.org/en/latest/integration/rest-api/content/retrieval.html#retrieve-a-single-unit there is no _href in response body,
Meanwhile retrieval of single repo also contains _href in response body.
As an additional info - when doing a generic search for unit https://pulp-dev-guide.readthedocs.org/en/latest/integration/rest-api/content/retrieval.html#search-for-units the response body contains _href.


Version-Release number of selected component (if applicable):

pulp-server-2.4.0-0.2.alpha.git.6.53c19dc.fc19.noarch
How reproducible:


Steps to Reproduce:
1.Retrieve a single unit with GET method with path /pulp/api/v2/content/units/<content_type>/<unit_id>/
2.
3.

Actual results:
_href not present in response body

Expected results:
_href present in the response body

Additional info:

Doing retrieval of single unit by providing its id:
_href not present
$ curl -H "Accept: application/json" -X GET -k -u admin:admin  'https://example.com/pulp/api/v2/content/units/puppet_module/557a6577-02be-4981-b80c-54cd0a853333/' | python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1109  100  1109    0     0   1398      0 --:--:-- --:--:-- --:--:--  1842
{
    "_content_type_id": "puppet_module", 
    "_id": "557a6577-02be-4981-b80c-54cd0a853333", 
    "_last_updated": "2014-02-13T14:54:33Z", 
    "_storage_path": "/var/lib/pulp/content/puppet_module/sbilo-jenkins-0.1.0.tar.gz", 
    "author": "sbilo", 
    "checksum": "0c1dd3f7e8bfb5dddfadc6488ce7f86168b0eddbe2a4adef5f2d8d94ac7e979f", 
    "checksum_type": "sha256", 
    "checksums": [
        [
            "spec/spec.opts", 
            "a600ded995d948e393fbe2320ba8e51c"
        ], 
        [
            "tests/init.pp", 
            "f3efee0dc58cbe32a1c03854b9801fa7"
        ], 
        [
            "spec/spec_helper.rb", 
            "3ea886dd135e120afa31e0aab12e85b0"
        ], 
        [
            "Modulefile", 
            "a26fdee8f1ca55cc682fa23cb1cb74e4"
        ], 
        [
            "Rakefile", 
            "f37e6131fe7de9a49b09d31596f5fbf1"
        ], 
        [
            "manifests/init.pp", 
            "6d32d585a2a6060a9a3674b08aeb0969"
        ], 
        [
            "README.md", 
            "bd49a65e501ff65f2c70b9c4b4a4a6e3"
        ], 
        [
            "manifests/instance.pp", 
            "a20f6163181f15ab47dfbb5242dd45d8"
        ]
    ], 
    "children": {}, 
    "dependencies": [
        {
            "name": "proteon-tomcat", 
            "version_requirement": ">= 0.1.15"
        }
    ], 
    "description": "", 
    "license": "", 
    "name": "jenkins", 
    "project_page": "", 
    "source": "", 
    "summary": "", 
    "tag_list": [
        "jenkins", 
        "continuous", 
        "integration", 
        "tomcat", 
        "hudson", 
        "ci"
    ], 
    "types": [], 
    "version": "0.1.0"
}

Meanwhile retrieval of single repo by its id contains _href:

$ curl -H "Accept: application/json" -X GET -k -u admin:admin  'https://example.com/pulp/api/v2/repositories/SimpleUnitSearchTest/' | python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   316  100   316    0     0    424      0 --:--:-- --:--:-- --:--:--   484
{
    "_href": "/pulp/api/v2/repositories/SimpleUnitSearchTest/", 
    "_id": {
        "$oid": "52fcdca1c053704cf2c55200"
    }, 
    "_ns": "repos", 
    "content_unit_counts": {
        "puppet_module": 17
    }, 
    "description": null, 
    "display_name": "SimpleUnitSearchTest", 
    "id": "SimpleUnitSearchTest", 
    "notes": {
        "_repo-type": "puppet-repo"
    }, 
    "scratchpad": {}
}

Even when doing search for units with a post method _href is present:

$ curl -H "Accept: application/json" -X POST -k -u admin:admin  -d '{"criteria": {"filters": {"name":"jenkins"}, "fields": ["name","_content_type_id"]}}' 'https://example.com/pulp/api/v2/content/units/puppet_module/search/' | python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   296  100   212  100    84    303    120 --:--:-- --:--:-- --:--:--   349
[
    {
        "_content_type_id": "puppet_module", 
        "_href": "/pulp/api/v2/content/units/puppet_module/557a6577-02be-4981-b80c-54cd0a853333/", 
        "_id": "557a6577-02be-4981-b80c-54cd0a853333", 
        "children": {}, 
        "name": "jenkins"
    }
]

Comment 1 Brian Bouterse 2015-02-28 22:02:35 UTC
Moved to https://pulp.plan.io/issues/397