Create Debate

When you want to add or create data in your debates component, you need to rely on the DebateAttributes type, which has the following input fields:

• title                 (required) - String
• description           (required) - String
• taxonomies            (optional) - Taxonomy ids to assign to this debate

Sample request

The CreateDebate mutation allows authenticated users to create new debates in a Decidim debates component. This mutation uses the existing CreateDebate command from the controller.

mutation createDebate($componentId: ID!, $input: CreateDebateInput!){
  component(id: $componentId) {
    ...on DebatesMutation{
      createDebate(input: $input) {
        id
        title { translation(locale: "en") }
        description { translation(locale: "en") }
        taxonomies {
          name { translation(locale: "en") }
        }
      }
    }
  }
}

Example of submitted variables

{
  "componentId": 5,
  "input": {
    "locale": "en",
    "attributes": {
      "description": "Cities need more people, not more cars",
      "taxonomies": [11],
      "title": "More sidewalks and less roads"
    }
  }
}