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

mutation { goalUpdate(input: {goalId: 12345, title: "test update"}) { clientMutationId } }
Share
Chef
@roy_shao @dhruvparmar any idea on this? :)
Full Stack Engineer @ProductHunt
@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 } }
@dhruvparmar thanks. This works for me. I'm new to GraphQL. Is it because my mutation syntax was wrong?
Full Stack Engineer @ProductHunt
@roy_shao yes, that might be the issue.