openzim / cms

ZIM file Publishing Platform
https://cms.openzim.org
GNU General Public License v3.0
4 stars 0 forks source link

Add filtering to the `/titles` listing endpoint #41

Closed anshulxyz closed 2 years ago

anshulxyz commented 2 years ago

refer https://github.com/openzim/cms/issues/29#issuecomment-987848283

GET /titles:

{
  "meta": {
    "count": 2,
    "limit": 10,
    "skip": 0
  },
  "items": [
    {"ident": "wikipedia_fr_all_maxi"},
    {"ident": "wikipedia_fr_all_nopic"}
  ]
}

Rule of thumb is that all list endpoints should use the same wrapping schema with the meta info for pagination. It means that it should also accept skip and limit parameters to control the result list. This is similar to what the zimfarm API does.

Now, this endpoint is gonna be the most used and must be versatile so it serves most if not all of the UI's needs (as well as other needs). It thus needs to allow filtering and payload-control using GET parameters.

Filters:

Payload-control:

Complete complex request: GET /titles?lang=fra&metadata-scraper=*1.11&tag=!wikipedia&with_tags&with_languages&with_medata=all

[
  {
    "ident": "wikihow_fr_all_maxi",
    "languages": [
      "fra"
    ],
    "metadata": {
      "Creator": "Wikipedia",
      "Description": "offline version of Wikipedia in Ganda",
      "Flavour": "maxi",
      "Language": "fra",
      "Name": "wikipedia_fr_all_maxi",
      "Publisher": "Kiwix",
      "Tags": "wikihow;_category:wikipedia",
      "Title": "Wikipedia",
      "Scraper": "wikihow2zim 1.11",
      "Illustration_48x48": "xxx"
    },
    "tags": [
      "wikihow",
      "_category:wikipedia"
    ]
  }
]
stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.