#2777 The project API returns 404 rather than an empty list when a query results in an empty collection
Closed: Fixed Opened by jcline.

If the query string you use results in 0 matches, Pagure responds with an HTTP 404 rather than an empty collection. For example: https://src.fedoraproject.org/api/0/projects?username=jclineeee.

This should return an empty collection.


Sounds reasonable :)

Metadata Update from @pingou:
- Issue tagged with: RFE, easyfix

Metadata Update from @vivekanand1101:
- Issue assigned to vivekanand1101

Fixed by @vivekanand1101 in https://pagure.io/pagure/pull-request/2805

Metadata Update from @pingou:
- Issue close_status updated to: Fixed

The new response is not compatible with the current paginated response:

{
  "args": {
    "fork": false,
    "namespace": null,
    "owner": "robled",
    "page": 1,
    "pattern": null,
    "per_page": 100,
    "short": true,
    "tags": [],
    "username": null
  },
  "pagination": {
    "first": "https://src.stg.fedoraproject.org/api/0/projects?fork=False&owner=robled&short=True&page=1&per_page=100",
    "last": "https://src.stg.fedoraproject.org/api/0/projects?fork=False&owner=robled&short=True&page=1&per_page=100",
    "next": null,
    "page": 1,
    "pages": 1,
    "per_page": 100,
    "prev": null
  },
  "projects": [
    {
      "description": "The rocket-depot rpms",
      "fullname": "rpms/rocket-depot",
      "name": "rocket-depot",
      "namespace": "rpms"
    }
  ],
  "total_projects": 1
}

versus

{
  "args": {
    "fork": false,
    "namespace": null,
    "owner": "stmiller",
    "pattern": null,
    "short": true,
    "tags": [],
    "username": null
  },
  "projects": [],
  "total_projects": 0
}

This breaks anything that was using pagination that expects that key to be present.

That key being ? total_projects?

"pagination". FMN has a pagination wrapper that expects that keyword to be there if the response was 200.

Metadata