You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ambari.apache.org by "Tom Beerbower (JIRA)" <ji...@apache.org> on 2015/01/21 21:30:34 UTC

[jira] [Commented] (AMBARI-8342) Requesting the config_groups collection resource with no registered configuration groups results in a 404 response

    [ https://issues.apache.org/jira/browse/AMBARI-8342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14286207#comment-14286207 ] 

Tom Beerbower commented on AMBARI-8342:
---------------------------------------

Same issue for other resource types ...

{quote}
The {{ClusterControllerImpl}} does not seem to differentiate between a {{null}} response from a ResourceProvider or an empty collection. When returning an empty collection, the API treats this as a missing resource and throws a 404 not found.

You can see this by requesting the following URI when there are no alerts:

http://localhost:8080/api/v1/clusters/c1/alerts

The problem is that a 404 should only be thrown when requesting a specific resource or an invalid endpoint. For alerts, this means that the predicate could be many different combinations, such as

http://localhost:8080/api/v1/clusters/c1/alerts?Alert/service_name=bar&Alert/host_name=baz

which could return 0 results as the predicate would strip them out. Only if the primary keys of the alert are in the predicate should the API throw a 404. For example, I'd expect this to to return a 404:

http://localhost:8080/api/v1/clusters/c1/alerts?Alert/id=9999999

since Alert/id is a primary key.
{quote}

> Requesting the config_groups collection resource with no registered configuration groups results in a 404 response
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: AMBARI-8342
>                 URL: https://issues.apache.org/jira/browse/AMBARI-8342
>             Project: Ambari
>          Issue Type: Bug
>          Components: ambari-server
>    Affects Versions: 1.7.0
>            Reporter: John Speidel
>            Assignee: Tom Beerbower
>              Labels: api
>             Fix For: 2.0.0
>
>
> GET http://AMBARI_HOST:8080/api/v1/clusters/c1/config_groups
> {
>   "status" : 404,
>   "message" : "The requested resource doesn't exist: ConfigGroup not found, ConfigGroup/cluster_name=c1"
> }
> The cluster c1 exists and has no configuration groups.  The above response is incorrect.  As per the api specification, it should return an empty collection.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)