Is there an example of using mutation to update goal?

Roy Shao
5 replies
I tried to change my goal in API explorer using my PH login, but I got error saying "SyntaxError: Unexpected token < in JSON at position 0" ``` mutation { goalUpdate(input: {goalId: 12345, title: "test update"}) { clientMutationId } } ```

Replies

Dhruv Parmar
@roy_shao can you try something like this, after logging in via product hunt in the explorer app mutation($goalUpdateInput: GoalUpdateInput!) { goalUpdate(input: $goalUpdateInput) { node { title id } } } and inside query variables you can put the input values like { "goalUpdateInput": { "goalId": goal_id, "title": new_title_here } }
Roy Shao
@dhruvparmar thanks. This works for me. I'm new to GraphQL. Is it because my mutation syntax was wrong?
Dhruv Parmar
@roy_shao yes, that might be the issue.
Roy Shao
mutation { goalUpdate(input: {goalId: 12345, title: "test update"}) { clientMutationId } }