---
title: "Understanding GraphQL for Beginners–Part Three"
description: "GraphQL mutations are the write side of the API, the counterpart to POST, PUT and DELETE in REST."
url: "https://swe.quest/articles/understanding-graphql-for-beginners-part-three-fa434e0e0fd5a698"
canonical: "https://shopify.engineering/understanding-graphql-for-beginners-part-three"
source: "Shopify Engineering"
published: "2021-08-06"
difficulty: "medium"
kind: "How-to"
reading_minutes: 6
tags: ["graphql","ruby","api-design"]
---

# Understanding GraphQL for Beginners–Part Three

A post on [Shopify Engineering](https://swe.quest/sources/shopify.md), published 2021-08-06, 6 min read, How-to. Original: [https://shopify.engineering/understanding-graphql-for-beginners-part-three](https://shopify.engineering/understanding-graphql-for-beginners-part-three)

## Summary

GraphQL mutations are the write side of the API, the counterpart to POST, PUT and DELETE in REST. They are sent to the same endpoint as queries, take their arguments under input, and run a single resolve method per schema field. Using the graphql-ruby generator (\`rails g graphql:mutation\`), the tutorial builds foodCreate, foodUpdate and foodDelete mutations for a Rails app. It shows how to declare snake\_case input arguments, which are auto-converted to camelCase, use a double splat to pass arguments into resolve, and create, update or destroy ActiveRecord objects, then test each mutation in GraphiQL. Exercises repeat the pattern for a Nutrition model.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [GraphQL](https://swe.quest/tags/graphql.md) (Backend & APIs)
- [Ruby](https://swe.quest/tags/ruby.md) (Languages)
- [API design](https://swe.quest/tags/api-design.md) (Backend & APIs)

## Prerequisites

- Ruby on Rails basics ([easy posts on Ruby](https://swe.quest/tags/ruby.md?difficulty=easy))
- ActiveRecord
- GraphQL queries ([easy posts on GraphQL](https://swe.quest/tags/graphql.md?difficulty=easy))

## Keywords

GraphQL, graphql-ruby, Ruby on Rails, ActiveRecord, GraphiQL

## Related posts

- [Understanding GraphQL for Beginners–Part Two](https://swe.quest/articles/understanding-graphql-for-beginners-part-two-824dc64184274e82.md): Shopify Engineering · 2021-07-02 · Medium · 8 min read · GraphQL, Ruby, API design
  A beginner walkthrough of adding GraphQL to a Ruby on Rails app using a food-and-nutrition example.
- [How pg\_graphql works](https://swe.quest/articles/how-pg-graphql-works-70dff1dd9d5a0c27.md): Supabase · 2024-01-24 · Medium · 9 min read · GraphQL, PostgreSQL, Rust, Compilers
  pg\_graphql is a Rust-based Postgres extension that reflects the SQL schema as a GraphQL schema and serves queries through a \`graphql.resolve\` SQL function, with no separate server.
- [Rewriting the CLI in Rust: Was It Worth It?](https://swe.quest/articles/rewriting-the-cli-in-rust-was-it-worth-it-da1e555358ca943e.md): Railway · 2023-03-10 · Medium · 9 min read · Rust, Developer tools, Refactoring & migrations, Go, GraphQL
  Railway rewrote its Go/Cobra CLI in Rust for v3 because the old codebase had untyped, string-defined GraphQL queries, dynamically registered flags that forced ~120 error guards, and assumptions predating multi-service projects.
- [pg\_graphql: Postgres functions now supported](https://swe.quest/articles/pg-graphql-postgres-functions-now-supported-279553dc083ab4d8.md): Supabase · 2023-12-12 · Medium · 4 min read · GraphQL, PostgreSQL, API design
  pg\_graphql 1.4+ reflects Postgres user-defined functions into the GraphQL schema, giving custom SQL logic a GraphQL entry point.
- [How to Build a GraphQL Server with Deno](https://swe.quest/articles/how-to-build-a-graphql-server-with-deno-b4bf15abf8edf07f.md): Deno · 2023-01-11 · Medium · 7 min read · GraphQL, TypeScript, PostgreSQL, API design
  A GraphQL API server can be built in Deno with the std HTTP Server, the gql middleware, graphql\_tools' makeExecutableSchema and graphql\_tag.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
