Loading...
Loading...
Mutations allow you to add, update or remove data pertaining to the authenticated user, such as their Profile, Connections or Accounts.
GraphQL natively supports performing multiple mutations in one request. Keep in mind that if you define multiple mutations in a single request, they will be executed sequentially in the order they're defined. This ensures that data from an earlier mutation is available to subsequent mutations.
Below are some of the Mutations generally available via GraphQL:
accountUpdate: Update an Account's metadata.connectionDisconnect: Disconnect a Connection.connectionSimulateError: Put a Connection into a repairable error state.connectionUpdate: Update a Connection's metadata.profileUpdate: Update Profile information.transactionUpdate: Update a Transaction's metadata.profileUpdate MutationIn this example, we will define a profile query to get the user's basic profile details:
mutation {
profileUpdate(input: { metadata: {firebaseId: "Xk3D12aB4zO7QW5z8s9Y"}}) {
success
record {
id
metadata
}
}
}
curl --request POST \
--url 'https://api.quiltt.io/v1/graphql' \
--header 'Authorization: Bearer <SESSION_TOKEN>' \
--header 'Content-Type: application/json' \
--data @- <<GRAPHQL
{
"query": "mutation {
profileUpdate(input: {metadata: {firebaseId: \"Xk3D12aB4zO7QW5z8s9Y\"}}) {
success
record {
id
name
}
}
}"
}
GRAPHQL
{
"data": {
"success": true,
"profile": {
"id": "p_11oaRngjEOLf1YcBdZqKp0E",
"metadata": {
"internalId": "abcdef"
}
},
"errors": null
}
}
In GraphQL, successful queries always return a data object that mirrors the structure of your request.
The Quiltt React SDK provides a built-in useMutation hook to call the Quiltt GraphQL API. Additionally, the GraphQL community provides a rich ecosystem of open-source clients and libraries that seamlessly plug-in to your client-side or server-side framework of choice.