Project

General

Profile

Actions

Bug #16415

closed

api/v2/ptables accepts only wrapped hash of attributes with "layout"

Added by roman plevka over 7 years ago. Updated almost 6 years ago.

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

Description

# rpm -qa foreman
foreman-1.13.0-0.develop.201608221148git5908bf4.el7.noarch
# rpm -qa katello
katello-3.1.0-4.nightly.el7.noarch

Partition table API endpoint has changed behavior in JSON it accepts.

The payload now needs to follow jsonapi standard in order to be accepted, bringing inconsistency to api/v2:

Old (consistent) way:

# curl -ku admin:changeme -H 'Content-Type: application/json' -d '{"name":"foo1", "layout":"my_layout"}' https://katello.server.com/api/v2/ptables
{
  "error": {"id":null,"errors":{"template":["can't be blank"],"layout":["can't be blank"]},"full_messages":["Template can't be blank","Layout can't be blank"]}
}

New format:

]# curl -ku admin:changeme -H 'Content-Type: application/json' -d '{"ptable":{"name":"foo1", "layout":"my_layout"}}' https://hp-dl380pgen8-02-vm-3.lab.bos.redhat.com/api/v2/ptables
{"layout":"my_layout","os_family":null,"created_at":"2016-09-01 13:25:18 UTC","updated_at":"2016-09-01 13:25:18 UTC","name":"foo1","id":79,"operatingsystems":[],"locations":[],"organizations":[]}

Actions

Also available in: Atom PDF