GQL: Using updateTicket mutation to update order states

I want to use GQL to Update Order States and see that the updateTicket mutation appears to include that functionality but it isn’t clear how to use the mutation in that way.

It was said that GQL is self documenting via the “documentation explorer” in the GraphiQL tool. The api basics are there but various details are still not well defined.

It appears that it is possible to select specific orders and specify a list of order states. I extracted, cleaned up, and customized a copy of the mutation description for this UpdateOrderStates operation.

To simplify and prepare the GQL call I skipped the arguments in the mutation which are not related, and have expanded the Orders and Order States parts.

so far this what i have:

updateTicket(
	ticketId: int,
	orderStates: 
		{stateName: String!, state: String, stateValue: String,  currentState: String!},
	orders: {uid: String, states: 
                          {stateName: String!, state: String, stateValue: String, currentState: String!},
},
)
: {id}

Does this syntax look right?
Has anyone here used updateTicket to Update Order States?

The graphiql documentation explorer indicates that the orders list describes new orders to be added to the ticket, but i wish to select orders in this case.

OK … After much experimentation with syntax i finally got this to be accepted:

mutation updateTicket {
updateTicket (ticketId: 3923, 
  ticketTags: [],
  orderStates: [{stateName: "Course", state: "Starter", currentState: "Main"}], 
  orders: [{name: "103 Fried rice + pineapple", states:[], tags:[]}],
  userName: "Administrator",
  ticketTypeName: "Ticket",
  note: "") {
  id
}
  }

but it adds a new order to the ticket.
OK. so i tried removing the orders:[{ }] part and it does update the order states but it updates all orders on the ticket. That makes sense … as there was no order specified.

I think when specifying an order with an id or uid which already exists, the updateTicket method should update the state of that specified order (instead of creating a new order with duplicate uid).

I’m still not sure if i am doing something wrong or whether it simply doesn’t support such operation.

More detailed documentation would save a lot of time experimenting and reverse engineering!