Project

General

Profile

Actions

Bug #4795

closed

Passing incorrect organization 'id' to product create should return 404

Added by Adam Saleh over 10 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Category:
API
Target version:
Difficulty:
Triaged:
Yes
Fixed in Releases:
Found in Releases:

Description

Description of problem:
Creating product by api doesn't work

Version-Release number of selected component (if applicable): {"name":"katello","version":"1.5.0-14.201403231838gitb03147e.el6"}

How reproducible:
Foreman with kattello installed required.

Steps to Reproduce:
curl -X POST -k -u admin:changeme -H "Content-Type: application/json" 'https://qetello01.usersys.redhat.com/katello/api/v2/products/' -d '{"organization_id": 1, "description": "test-prod-desc", "name": "test-product1"}'

Actual results: {"displayMessage":"PGError: ERROR: operator does not exist: character varying = integer\nLINE 1: ...\"taxonomies\".\"deletion_task_id\" IS NULL AND (name = 1 or lab...\n ^\nHINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.\n: SELECT \"taxonomies\".* FROM \"taxonomies\" WHERE \"taxonomies\".\"type\" IN ('Organization') AND \"taxonomies\".\"deletion_task_id\" IS NULL AND (name = 1 or label = 1) ORDER BY title LIMIT 1","errors":["PGError: ERROR: operator does not exist: character varying = integer\nLINE 1: ...\"taxonomies\".\"deletion_task_id\" IS NULL AND (name = 1 or lab...\n ^\nHINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.\n: SELECT \"taxonomies\".* FROM \"taxonomies\" WHERE \"taxonomies\".\"type\" IN ('Organization') AND \"taxonomies\".\"deletion_task_id\" IS NULL AND (name = 1 or label = 1) ORDER BY title LIMIT 1"]}

Expected results:
200 response accomanied with product hash

Additional info:
Same error when creating provider.

Actions #2

Updated by Bryan Kearney over 10 years ago

@Dcleal is this the "you need to use locations" issue?

Actions #3

Updated by Dominic Cleal over 10 years ago

Bryan Kearney wrote:

@Dcleal is this the "you need to use locations" issue?

No, that's an error on the organisation edit page. I've no idea what this is.

Actions #4

Updated by Justin Sherrill over 10 years ago

It looks like this is simply due to you passing the org id for Organization id instead of the org label (which sounds really silly).

I get the same error when specifying organization_id: 1, but if i use:

'{"organization_id": "ACME_Corporation", "description": "test-prod-desc", "name": "test-product1"}'

It seems to work fine. However, i would expect the org lookup to return a 404 versus this strange error.

Actions #5

Updated by Justin Sherrill over 10 years ago

  • Subject changed from Creating product with api doesn't work. to Passing incorrect organization 'id' to product create should return 404
Actions #6

Updated by Justin Sherrill over 10 years ago

  • Status changed from New to Assigned
  • Assignee set to Justin Sherrill
Actions #7

Updated by Anonymous over 10 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

Applied in changeset katello|commit:43a8c4d13b89967fc735d1ebc856fe2195be3946.

Actions #8

Updated by Eric Helms over 10 years ago

  • Triaged changed from No to Yes
Actions #9

Updated by Eric Helms over 10 years ago

  • Translation missing: en.field_release set to 13
Actions

Also available in: Atom PDF