This site uses cookies. By continuing to browse the site, you agree to our use of cookies. Find out more about cookies.
Skip to main content
Metadecidim's official logo
  • English Triar la llengua Elegir el idioma Choose language
    • Català
    • Castellano
Sign Up Sign In
  • Home
  • Processes
  • Assemblies
  • Initiatives
  • Consultations
  • Conferences
  • Help

Support Forum

#supportforum Any doubts or questions on how to use Decidim? Check them with the Community!

  • The process
  • I have a question
  • Community Tutorials
chevron-left Back to list

API: help or examples

Avatar: Kris De Winter Kris De Winter
29/07/2019 16:42  

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

  • Filter results for category: Other Other

List of Endorsements

Avatar: Ivan Vergés Ivan Vergés verified-badge
Avatar: Pau Parals Pau Parals verified-badge
Endorsements count2
API: help or examples Comments 4

Reference: MDC-PROP-2019-07-14715
Version number 1 (of 1) see other versions
Check fingerprint

Fingerprint

The piece of text below is a shortened, hashed representation of this content. It's useful to ensure the content hasn't been tampered with, as a single modification would result in a totally different value.

Value: d33cff614eadb7e7dc8bd6bcaf446eb2c2474fcfe098c9cd2b7132a6ef89754e

Source: {"body":{"en":"Hello,\r\n\r\nI 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?\r\n\r\nSpecifically I'm looking for examples that would help me to set up a query whereby:\r\n- I can list the assemblies a user is a member of\r\n- I can list a summary of the content of an assembly (the proposals, meetings, meeting reports, ...)\r\n\r\nThanks for pointing me in the right direction,\r\nKris"},"title":{"en":"API: help or examples"}}

This fingerprint is calculated using a SHA256 hashing algorithm. In order to replicate it yourself, you can use an MD5 calculator online and copy-paste the source data.

Share:

link-intact Share link

Share link:

Please paste this code in your page:

<script src="https://meta.decidim.org/processes/supportforum/f/705/proposals/14715/embed.js"></script>
<noscript><iframe src="https://meta.decidim.org/processes/supportforum/f/705/proposals/14715/embed.html" frameborder="0" scrolling="vertical"></iframe></noscript>

Report inappropriate content

Is this content inappropriate?

Reason

4 comments

Order by:
  • Older
    • Best rated
    • Recent
    • Older
    • Most discussed
Avatar: Pau Parals Pau Parals verified-badge
29/07/2019 17:06
  • Get link Get link

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

Avatar: Ivan Vergés Ivan Vergés verified-badge
29/07/2019 18:42
  • Get link Get link

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
}
}
}
}

Avatar: Ivan Vergés Ivan Vergés verified-badge
29/07/2019 18:44
  • Get link Get link

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

Avatar: Kris De Winter Kris De Winter
30/07/2019 10:58
  • Get link Get link

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 ...

  • Terms and conditions of use
  • About the community
  • Download Open Data files
  • Metadecidim at Twitter Twitter
  • Metadecidim at Instagram Instagram
  • Metadecidim at YouTube YouTube
  • Metadecidim at GitHub GitHub
Creative Commons License Website made with free software.
Decidim Logo

Confirm

OK Cancel

Please sign in

decidim Sign in with Decidim
Or

Sign up

Forgot your password?