I've been doing fine querying but I'm just having a hard time understanding the mutation side of things. If I just had an example or two of how to do that in payload, that would be immensely helpful.
thank you
ok, I was able to get over this very basic aspect of gql, lol.
I created a collection called "accounts" that for now just has a couple simple text fields
Then the mutation looks like this:
mutation createAccount($data: mutationAccountInput!) {
createAccount(data: $data) {
email
authKey
sessionKey
authKeyExpiresAt
}
}
and the variables I passed in looked like this
{
"data": {
"email": "test@test.com",
"authKey": "5555555",
"sessionKey": "5555555",
"authKeyExpiresAt": "5555555"
}
}
mutation successful!
The thing that confused me at first was the fact that the fields you list out are for the
returndata. They're not actually needed to perform the mutation.
I also was missing the
!
in the mutation argument type.
Hope this is useful to someone in the future!
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.