Support Forum
#supportforum Any doubts or questions on how to use Decidim? Check them with the Community!
API: help or examples
Hello,
I know about the api documentation at /api/docs and have been trying out various queries. It would however be helpful if there were query examples available somewhere. Are there resources anyone can point me too?
Specifically I'm looking for examples that would help me to set up a query whereby:
- I can list the assemblies a user is a member of
- I can list a summary of the content of an assembly (the proposals, meetings, meeting reports, ...)
Thanks for pointing me in the right direction,
Kris
List of Endorsements
Report inappropriate content
Is this content inappropriate?
4 comments
Hi @kdw2060, I am not a developer, but it always helps me to look at the epics of how things were built. I leave the one of the API here: https://github.com/decidim/decidim/issues/2623
Besides, I don't know if you know the gitter. It is a chat where there are the majority of Decidim developers and they are usually faster answering than in meta.decidim: https://gitter.im/decidim/decidim
If in the end it doesn't exist, I encourage you to build some examples :P
Take also into account that not everything is possible and the API is not completed yet, there are missing areas. Specially user-related things may not be available due privacy concerns.
Some examples:
list assemblies:
{
assemblies {
id
title {
translations {
locale
text
}
}
}
}
Participatory processes:
{
participatoryProcess(id: 15) {
id
title {
translations {
locale
text
}
}
components {
id
__typename
name {
translation(locale: en)
}
... on Proposals {
proposals {
edges {
node {
id
body
address
comments {
id
body
author {
avatarUrl
name
}
}
}
}
}
}
}
}
}
You can do the same with
...on Pages
...on Meetings
Press CTRL+SPACE to find what¡s available inside a specific place
Thank you for the quick responses Ivan and Pau. Reading the epic made clear that everything I would want to do is not yet possible. Still having some trouble to understand where to nest certain elements that are already available though.
I've tried putting 'Meeting(id: x)'; 'Meetings'; 'Proposals'; 'Proposal(id: x)' in different parts of the query (top level and nested) but can't find where I should place them (also not with the autocomplete). I would expect those to be children of 'Assembly' or 'Components', but they aren't.
I haven't got enough characters available here to post my query (or the query-url). But this is a snippet where I'd logically expect to be able to insert those elements:
assembly(id: 1) {
title {
translation(locale: "nl")
}
components {
id
__typename
name {
translation(locale: "nl")
}
}
}
Add your comment
Sign in with your account or sign up to add your comment.
Loading comments ...