Usage
Mutations

Mutations

️❗️

Mutations are disabled by default. If you want to protect them from the outside world consider enabling your Secret Token as well

Create, update and delete records

Insert

When inserting a new record you can get the generated id immediately:

mutation {
insert_people(
name: "John",
vegan: true,
friends: ["recXYZ789"]
) {
id, name, vegan,
friends { name }
}
}
{
insert_people [{
id: "recABC123",
name: "John",
vegan: true,
friends: [
{ name: "Peter" }
]
}]
}

Update

When updating an existing record you must provide an id to locate it along the attributes to be updated:

mutation {
update_people(
id: "recABC123", # required
vegan: false,
friends: [
"recXYZ789", "recDEF456"
]
) {
id, name, vegan,
friends { name }
}
}
{
insert_people [{
id: "recABC123",
name: "John",
vegan: false,
friends: [
{ name: "Peter" },
{ name: "Rodrick" }
]
}]
}

Delete

When deleting a record only an id is needed:

mutation {
delete_people(
id: "recABC123", # required
) { }
}
{
insert_people [{
id: "recABC123"
}]
}