Rest API v2 returns http-404 (not found) for http-204 (no content) cases

Description

Rest calls against the api/v2 rest api return wrong http-404 status codes.
If the result sets are empty the api always returns http-404 instead of http-204 for no content.
For example a call against the nodes returns a 404 if no nodes exist.
Calls using a criteria that causes an empty result also returns an 404 instead of http-204.

relevant class:
org.opennms.web.rest.v2.AbstractDaoRestService

Acceptance / Success Criteria

None

Lucidchart Diagrams

Activity

Seth Leger November 11, 2015 at 10:32 PM

When I was working on the RESTv2 services, I was going by the guidelines in this document:

http://www.restapitutorial.com/media/RESTful_Best_Practices-v1_1.pdf

They don't specifically say what should happen when you perform a filtering query on a root resource and the result has no elements, but I think that code 204 makes sense. Please commit this change to 18.0.0.

Markus von Rüden November 11, 2015 at 6:14 AM

The pull request can be found here: https://github.com/OpenNMS/opennms/pull/451

Fixed

Details

Assignee

Reporter

Components

Sprint

Fix versions

Affects versions

Priority

PagerDuty

Created November 10, 2015 at 4:55 AM
Updated November 12, 2015 at 2:07 PM
Resolved November 12, 2015 at 9:08 AM