Project

General

Profile

Actions

Bug #6248

closed

Some JSON responses are still nested in a root node

Added by David Davis almost 10 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

I was reviewing this bug: https://bugzilla.redhat.com/show_bug.cgi?id=1087372 but it doesn't look like everything was fixed.

$ curl "http://localhost:3000/katello/api/v2/organizations.json" -d '{"name": "Test20071"}' -u admin:changeme -H "Accept: application/json" -H "Content-Type: application/json" {"organization":{"ancestry":null,"apply_info_task_id":null,"created_at":"2014-06-16T18:27:59Z","default_info":{"system":[],"distributor":[]},"deletion_task_id":null,"description":null,"id":4,"ignore_types":[],"label":"Test20071","name":"Test20071","owner_auto_attach_all_systems_task_id":null,"title":"Test20071","updated_at":"2014-06-16T18:28:03Z","service_levels":[],"service_level":null}}

It looks like the output is still being wrapped. Here's another object:

$ curl "http://localhost:3000/katello/api/v2/products.json" -d '{"name": "TEST", "organization_id": "1"}' -u admin:changeme -H "Accept: application/json" -H "Content-Type: application/json" {"organization":{"name":"ACME_Corporation","label":"ACME_Corporation"},"created_at":"2014-06-16T18:39:15Z","updated_at":"2014-06-16T18:39:15Z","readonly":false,"id":97,"cp_id":null,"name":"TEST","label":"TEST","description":null,"provider_id":1,"sync_plan_id":null,"sync_status":{"created_at":null,"finish_time":null,"id":null,"organization_id":null,"parameters":{},"progress":{"items_left":0,"total_count":0,"size_left":0,"total_size":0},"result":null,"start_time":null,"state":"not_synced","task_owner_id":null,"task_owner_type":null,"task_type":null,"updated_at":null,"user_id":0,"uuid":null},"gpg_key_id":null,"redhat":false,"product_content":[],"available_content":[],"repository_count":0,"permissions":{"deletable":true},"library_repositories":[],"provider":{"name":"Anonymous"},"":null}

Notice how the attributes are not wrapped.


Related issues 3 (0 open3 closed)

Related to Foreman - Bug #5178: Users API requires parameters to be wrappedClosedJoseph Magen04/14/2014Actions
Related to Foreman - Bug #4181: V2: Api docs in foreman should not specify a root node for POST/PUTRejectedJoseph Magen01/24/2014Actions
Related to Foreman - Bug #6715: revert API v2 GET response to wrapped parameters using object nodeRejectedJoseph Magen07/22/2014Actions
Actions #1

Updated by Dominic Cleal almost 10 years ago

Should this be in the Katello project as those are Katello controllers?

Foreman has an existing bug #5880 open about two controllers (taxonomies, users) which have a similar issue.

Actions #2

Updated by David Davis almost 10 years ago

So in the Katello controller for organization, we're just extending the foreman organization controller so I think bug #5880 should suffice. I think we can close this out as a dupe of that bug. Sorry I missed that.

Actions #4

Updated by Dominic Cleal almost 10 years ago

  • Status changed from New to Duplicate
Actions #5

Updated by David Davis almost 10 years ago

  • Status changed from Duplicate to Assigned
  • Assignee set to Joseph Magen

I was having connection issues and accidentally deleted #5880. Here's its description from Google cache (Jun 15, 2014 11:43:17 GMT).

The return values of these API calls are not consistent:

when creating an organization, the return value is an organization hash embedded in a higher level hash with one "organization" key {"organization" => organization_hash} {"organization"=>{"apply_info_task_id"=>nil, "updated_at"=>"2014-04-14T09:21:50Z", "description"=>"Imported 'Red Hat IT' organization from Red Hat Satellite 5", "default_info"=>{"system"=>[], "distributor"=>[]}, "id"=>2, "deletion_task_id"=>nil, "owner_auto_attach_all_systems_task_id"=>nil, "ancestry"=>nil, "created_at"=>"2014-04-14T09:21:49Z", "service_level"=>nil, "title"=>"Red Hat IT", "name"=>"Red Hat IT", "label"=>"Red_Hat_IT", "ignore_types"=>[], "service_levels"=>[]}}
when creating a new user, the API return value is a simple user_hash. {"locations"=>[], "lastname"=>"another", "firstname"=>"another", "roles"=>[{"name"=>"Anonymous", "id"=>8}], "updated_at"=>"2014-04-14T09:26:32Z", "admin"=>nil, "last_login_on"=>nil, "usergroups"=>[], "organizations"=>[{"title"=>"Red Hat IT", "name"=>"Red Hat IT", "id"=>5}], "created_at"=>"2014-04-14T09:26:32Z", "mail"=>"root@localhost", "id"=>4, "auth_source_id"=>1, "auth_source_name"=>"Internal", "login"=>"another", "auth_source_internal"=>{"type"=>"AuthSourceInternal", "name"=>"Internal", "id"=>1}}
Version-Release number of selected component (if applicable):
sat6-Satellite-6.0.3-RHEL-6-20140404.0-Satellite-x86_64-dvd1.iso

This is a request to unify to API parameter and return value encapsulation.

Actions #6

Updated by David Davis almost 10 years ago

  • Status changed from Assigned to Duplicate
Actions #7

Updated by David Davis almost 10 years ago

  • Status changed from Duplicate to Ready For Testing
Actions #9

Updated by Dominic Cleal almost 10 years ago

  • translation missing: en.field_release set to 10
Actions #10

Updated by Dominic Cleal almost 10 years ago

  • Related to Bug #5178: Users API requires parameters to be wrapped added
Actions #11

Updated by Dominic Cleal almost 10 years ago

  • Related to Bug #4181: V2: Api docs in foreman should not specify a root node for POST/PUT added
Actions #12

Updated by Joseph Magen almost 10 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100
Actions #13

Updated by Dominic Cleal almost 10 years ago

  • Related to Bug #6715: revert API v2 GET response to wrapped parameters using object node added
Actions

Also available in: Atom PDF