Bug 1396551

Summary: error when PUTing a numeric id to /api/v2/hosts/:id for any *_id attributes
Product: Red Hat Satellite Reporter: Rob Marti <rmarti>
Component: APIAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED ERRATA QA Contact: Marek Hulan <mhulan>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2.0CC: bbuckingham, hprakash, jcallaha, mhulan
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-21 16:54:17 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:
Bug Depends On:    
Bug Blocks: 1479962    

Description Rob Marti 2016-11-18 15:38:58 UTC
JSON provided:

{
    "architecture_id": 1
}

Response:

{
  "error": {
    "message": "ERROR:  operator does not exist: character varying = integer\nLINE 1: ...architectures\".\"id\" = 1 OR \"architectures\".\"name\" = 1))  ORD...\n                                                             ^\nHINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.\n" 
  }
}

Ultimately, one should be able to provide the exact same JSON received from a GET on /api/v2/hosts/:id back as a PUT without errors.

From http://projects.theforeman.org/issues/13670

Customer is running into this.  If he typecasts it as a string there are no errors.

Comment 3 hprakash 2017-03-30 07:12:40 UTC
While this ticket is being worked, can we amend the API doc- https://<satellite-fqdn>/apidoc/v2/hosts/create.html for passing the hostgroupd_id as string?

Comment 6 Satellite Program 2018-02-21 16:54:17 UTC
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA.
> 
> For information on the advisory, and where to find the updated files, follow the link below.
> 
> If the solution does not work for you, open a new bug report.
> 
> https://access.redhat.com/errata/RHSA-2018:0336