Project

General

Profile

Actions

Refactor #13763

open

Updating facets should not require this strange and unRESTful format

Added by Walden Raines over 8 years ago.

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

Description

Currently to update a facet on a host you have to provide this strange format:

PUT /hosts/:id

{
    ...
    "content_facet_attributes": {
        "content_view_id": 2,
        "lifecycle_environment_id": 1
    }
    ...
}

Note the superfluous _attributes and the use of _id for what could just be an object. When you GET /hosts/:id the format received does not contain _attributes and thus requires the client to do a transformation on the object before sending it back.

I would expect the following instead:

PUT /hosts/:id

{
    ...
    "content_facet": {
        "content_view": {
             id: 2
        }
        "lifecycle_environment": {
             id: 1
        }
    }
    ...
}

Or, this:

PUT /hosts/:id/content

{
    ...
    "content_view": {
         id: 2
    }
    "lifecycle_environment": {
         id: 1
    }
    ...
}

I'd be willing to compromise as to the use of content_view_id and lifecycle_environment_id instead of their corresponding objects. I should always be able to PUT /hosts/:id the result from GET /hosts/:id without any changes.

No data to display

Actions

Also available in: Atom PDF