Bug 736716

Summary: Api for listing products returns two ids per product
Product: Red Hat Satellite Reporter: Tomas Strachota <tstrachota>
Component: APIAssignee: Tomas Strachota <tstrachota>
Status: CLOSED CURRENTRELEASE QA Contact: Garik Khachikyan <gkhachik>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.0.0CC: gkhachik, mkoci
Target Milestone: Unspecified   
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-08-22 17:56:26 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 747354    

Description Tomas Strachota 2011-09-08 13:47:22 UTC
Description of problem:

Api for listing products returns two ids per product. One of them is Active Record id, the second one is candlepin product id.

curl -H Content-Type: application/json -H Accept: application/json -#  -k -u admin:admin http://localhost:3000/api/organizations/ACME_Corporation/products

[
  {
    "last_sync": "2011-09-07T10:21:56+02:00",
    "name": "prod_a1",
    "created_at": "2011-09-07T08:21:28Z",
    "productContent": [

    ],
    "provider_id": 7,
    "multiplier": 1,
    "attributes": [

    ],
    "multiplier": 1,
    "updated_at": "2011-09-07T08:21:28Z",
    "sync_plan_id": 25,
    "id": 14,
    "provider_name": "prov_a1",
    "description": null,
    "sync_state": "not_synced",
    "id": "1315383688377"
  }
]


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


How reproducible:
always

Steps to Reproduce:
1. clean katello
2. add a product
3. list products in an organization via api
  
Actual results:
Returned json contains candlepin and activerecord id, both under key "id".

Expected results:
There should be only the candlepin product id.


Additional info:

Comment 1 Tomas Strachota 2011-09-12 10:16:06 UTC
Fixed, added :exclude constraint in Product#serializable_hash

commit 7eee0f4cbe040295d2e98ad6e29f34df2b2b2f93
Author: Tomas Strachota <tstrachota>
Date:   Mon Sep 12 12:10:51 2011 +0200

    736716 - product api was returning 2 ids per product

Comment 2 Garik Khachikyan 2011-09-23 13:32:40 UTC
# VERIFIED

fixed. now there is one id (candlepin_id) is returning back:

---
[
  {
    "name": "bz1",
    "created_at": "2011-09-23T12:38:33Z",
    "productContent": [

    ],
    "provider_id": 13,
    "attributes": [

    ],
    "updated_at": "2011-09-23T12:38:33Z",
    "multiplier": 1,
    "sync_state": "finished",
    "sync_plan_id": 25,
    "id": "1316781513084",
    "provider_name": "bz1",
    "last_sync": "2011-09-23T08:42:38-04:00",
    "description": null
  }
]
---

Checked against: katello-0.1.83-1.git.48.02111ba.fc15.noarch