Bug 736716 - Api for listing products returns two ids per product
Summary: Api for listing products returns two ids per product
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Satellite 6
Classification: Red Hat
Component: API
Version: 6.0.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified vote
Target Milestone: Unspecified
Assignee: Tomas Strachota
QA Contact: Garik Khachikyan
URL:
Whiteboard:
Depends On:
Blocks: katello-blockers
TreeView+ depends on / blocked
 
Reported: 2011-09-08 13:47 UTC by Tomas Strachota
Modified: 2015-01-04 21:58 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-08-22 17:56:26 UTC


Attachments (Terms of Use)

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@redhat.com>
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


Note You need to log in before you can comment on or make changes to this bug.