Create Budget

Input attributes

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

• title                 (Optional) - JSON
• description           (Optional) - JSON
• total_budget          (Optional) - Integer
• weight                (Optional) - Integer

Sample request

The CreateBudget mutation allows authenticated administrators to create new budgets in a Decidim budget component. This mutation uses the existing CreateBudget command from the admin controller.

mutation createBudget($componentId: ID!, $input: CreateBudgetInput!){
  component(id: $componentId) {
    ... on BudgetsMutation {
      createBudget(input: $input){
        id
        url
      }
    }
  }
}

Example of submitted variables

{
  "componentId": "3",
  "input": {
    "attributes": {
      "totalBudget": 1234,
      "title": {
        "en": "Budget created from API"
      }
    }
  }
}