githubEdit

Mutations

Mutations are used to create, update or delete objects in Bunny.

Building the mutation request is similar to building a query in the sense that you will construct a query and supply a set of input attributes. However, with mutations you can also control the type and fields that are returned once the mutation has completed.

For example, to create an accountarrow-up-right and then return the id and name of the new account your mutation will look like this.

mutation accountCreate ($attributes: AccountAttributes!) {
  accountCreate (attributes: $attributes) {
      account {
        id
        name
      }
      errors
  }
}

You will also need to supply valid attributes for creating an account like this

{
  "accountTypeId": "456123",
  "industryId": "456123",
  "employees": 123,
  "annualRevenue": 123,
  "name": "",
  "billingStreet": "",
  "billingCity": "",
  "billingState": "",
  "billingZip": "",
  "billingCountry": "",
  "billingEmail": "",
  "shippingStreet": "",
  "shippingCity": "",
  "shippingState": "",
  "shippingZip": "",
  "shippingCountry": "",
  "description": "",
  "phone": "",
  "fax": "",
  "website": "",
  "currencyId": "456123",
  "groupId": "456123",
  "netPaymentDays": 123,
  "duns": "",
  "ownerUserId": "456123"
}

To make the request simply combine the mutation query and attributes.

Last updated

Was this helpful?