Update Project

Input attributes

When you want to update a project inside your budget component, you need to rely on the ProjectAttributes type, which has the following input fields:

• address               (Optional) - String
• budget_amount         (Optional) - Integer
• description           (Optional) - JSON
• latitude              (Optional) - Float
• longitude             (Optional) - Float
• proposal_ids          (Optional) - Proposal ids to assign to this project
• title                 (Optional) - JSON
• taxonomies            (Optional) - Taxonomy ids to assign to this project

Sample request

The UpdateProject mutation allows authenticated administrators to update existing projects within a budget in a Decidim budget component. This mutation uses the existing UpdateProject command from the admin controller.

mutation updateProject($componentId: ID!, $budgetId: ID!, $input: UpdateProjectInput!){
   component(id: $componentId){
    ... on BudgetsMutation {
      budget(id: $budgetId){
      	updateProject(input: $input){
        	id
          url
        }
      }
    }
  }
}

Example of submitted variables

{
  "componentId": "3",
  "budgetId": "5",
  "input": {
    "id": "5",
    "attributes": {
      "budgetAmount": 12300,
      "address": "FOOBAR",
      "latitude": 123,
      "longitude": 12.33,
      "proposalIds": [ 1, 2, 3],
      "taxonomies": [ 1, 2, 3],
      "description": {
        "en": "Project description changed from API"
      },
      "title": {
        "en": "Project title changed from API"
      }
    }
  }
}

Error Handling

The most frequent errors that can be generated by this mutation are as follows:

Caveats

Sometimes, you may get a server response like:

{
  "errors": [
    {
      "message": [],
      "locations": [
        {
          "line": 5,
          "column": 8
        }
      ],
      "path": [
        "component",
        "budget",
        "updateProject"
      ],
      "extensions": {
        "code": "ATTRIBUTE_VALIDATION_ERROR"
      }
    }
  ],
  "data": {
    "component": {
      "budget": {
        "updateProject": null
      }
    }
  }
}

To fix this, please check your taxonomy parameters.