Answer Proposal

Allows administrators to answer proposals with a status (accepted, rejected, or evaluating).

This is an example on how to use the addProposalAnswer mutation. Please refer to the GraphQL documentation for the available fields:

mutation addProposalAnswer($componentId: ID!, $proposalId: ID!, $input: AnswerInput!){
  component(id: $componentId) {
    ...on ProposalsMutation{
      proposal(id: $proposalId) {
        answer(input: $input) {
          // this is the proposal response
        }
      }
    }
  }
}

Example of submitted variables

{
  "componentId": 9,
  "proposalId": 2,
  "input": {
    "clientMutationId": "unique-client-id-123",
    "attributes": {
      "state": "accepted",
      "cost": 10.0,
      "answerContent": {
         "en": "Some answer in English",
         "ca": "Some answer in Catalan"
      }
    }
  }
}

HTTP Request Example

Using cURL to make the GraphQL request:

curl -X POST https://your-decidim-instance.org/api \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -d '{
    "query": "mutation addProposalAnswer($componentId: ID!, $proposalId: ID!, $input: AnswerInput!){ component(id: $componentId) { ...on ProposalsMutation{ proposal(id: $proposalId) { answer(input: $input) { /* this is the proposal response */  } } } } }",
    "variables": {
      "input": {
        "componentId": 9,
        "proposalId": 2,
        "input": {
          "clientMutationId": "unique-client-id-123",
            "attributes": {
            "state": "accepted",
            "cost": 10.0,
            "answerContent": {
              "en": "Some answer in English",
              "ca": "Some answer in Catalan"
            }
          }
        }
      }
    }
  }'

Error Handling

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