What is the difference between Queries and Mutations in code?
The big difference is that next to a query property, you have to send a variable property with the request. See the official GraphQL documentation for more information: https://graphql.org/learn/queries/#mutations
How to update data in epowerhr specifically?
We'll use the 'baseSavePerson'-mutation as an example:
A mutation always has two properties:
1. An object specific to the type of object you want to update (in this example 'person')
- This object will always have an 'id'-property. If you know the id directly, you can always fill in this property and ignore the 'reference'-object.
- Only fill in the properties on the object you want to be updated. Properties not filled in will be ignored and will stay the same in the database.
2. A 'referenceType'-object (in this example 'reference')
- This is an optional object. This property will only be used if the id on the specific object is not filled in.
- This object is used to find the first object relatively with another property, like an external-id or a reference-id.
- To know which property to use on this reference-object, you'll have to get in contact with epowerhr, because this is specific to the setup of the client in epowerhr.