Project

General

Profile

Actions

Feature #13877

open

Use same name and syntax for "order" parameter as API v2 response "sort" field

Added by Walden Raines about 8 years ago. Updated about 8 years ago.

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

Description

According to the docs (http://theforeman.org/manuals/1.10/index.html#5.1.2JSONResponseFormatforCollections) the sort param is supposed to look like this:

...
"sort": {
    "by": null,
    "order": null
}
...

And should thus be accessible via /api/v2/hosts?sort_by=environment&sort_order=ASC

However it appears to be using the form sort="field ASC" which is not inline with the docs or what was agreed upon for a v2 API.

Actions #2

Updated by Dominic Cleal about 8 years ago

  • Status changed from New to Feedback

The section and example you're referring to is describing the response, not the parameter accepted by the API.

The accepted parameter is "order", specified in the apipie docs and section 5.1.4, customisation of the response: http://theforeman.org/manuals/1.10/index.html#5.1.4CustomizeJSONResponses, "Custom Sort of Collections Per Response".

Actions #3

Updated by Walden Raines about 8 years ago

I consider this a bug and not simply "feedback" as we are returning something different from what we expect as input which is strange at the very least.

Actions #4

Updated by Dominic Cleal about 8 years ago

  • Tracker changed from Bug to Feature
  • Subject changed from Sort by implementation in the api does not match the docs to Use same name and syntax for "order" parameter as API v2 response "sort" field
  • Status changed from Feedback to New

This isn't a bug against the docs as then, I've updated the ticket title accordingly. It might be strange, but the API responses and inputs are not designed or documented to be interchangeable.

Actions

Also available in: Atom PDF