Include static pages (help section) in the GraphQL API
Is your feature request related to a problem? Please describe.
Currently the Decidim API does not cover the /pages section of the website which is generally used to create help sections or other static content on Decidim websites.
Describe the solution you'd like
I would like the /pages section to be covered by the API. The provided fields are very similar to the pages component within the participatory spaces but this would have to be extended with the topic information.
The query I would expect to work would be something like this at the root level of the site:
{ staticContent { pages { topic { id, title(locale: "en") { text } }, id, title(locale: "en") { text }, body(locale: "en") { text }, createdAt, updatedAt } } }
Also, I would like the topics to be queryable through the API as follows:
{ staticContent { topics { id, title(locale: "en") { text }, pages { id, title(locale: "en") { text } } } } }
And additionally it would be nice to have if the "pages" query would allow filtering by topics as follows:
{ staticContent { pages(topic: 123) { id, title(locale: "en") { text } } } }
And pages without a topic:
{ staticContent { pages(topic: false) { id, title(locale: "en") { text } } } }
The "topic" filter would have the following alternative values:
-
null
(default) - return all pages, no matter if they have topic or not -
(number)
- return pages with this defined topic -
(array[number])
- return pages with these defined topics -
true
- return pages with any topic defined -
false
- return pages without topic defined
Describe alternatives you've considered
Currently the content can be fetched by scraping the /pages section and parsing the details from there. But this can be problematic at times when the layout is customized, i.e. the same scraping and parsing code may not work automatically for all Decidim instances.
Additional context
I needed to backup some content in the /pages section (that is about to change) and wrote a script for that particular website. This script could be more easily reusable in case the content was available through the API.
Does this issue could impact on users private data?
No.
Funded by
We can take this to our backlog if accepted.
Compartir