GraphQL input of type EmailAddress is giving error

I’m trying to create a public ticket with this “CreatePublicTicketMutationInput” with this query:

mutation mut($input: CreatePublicTicketMutationInput) {
  createPublicTicket(input: $input) {
id
  }
}
           // ---------------- VARIABLE
{
  "input":{
    "subject":"test",
    "description": "desc1",
    "status": "OPEN",
    "priority": "MEDIUM",
    "inbound_mailbox_id": 1,
    "ticketable_type": "Account",
    "ticketable_id": 1879,
    "ticket_group_id": 66,
    "ticket_recipients": {
      "email_address": "my@email.com",
      "name":  "My Name" 
    }
  }
}

But I’m getting this error.

Expected type CreateTicketRecipientDuringTicketCreationMutationInput to be an object at value.ticket_recipients.email_address


{
  "errors": [
    {
      "message": "Variable \"$input\" got invalid value {\"subject\":\"test\",\"description\":\"desc1\",\"status\":\"OPEN\",\"priority\":\"MEDIUM\",\"inbound_mailbox_id\":1,\"ticketable_type\":\"Account\",\"ticketable_id\":1879,\"ticket_group_id\":66,\"ticket_recipients\":{\"email_address\":\"myemail@gmail.com\",\"name\":\"test name\"}}; Expected type CreateTicketRecipientDuringTicketCreationMutationInput to be an object at value.ticket_recipients.email_address.\n\nVariable \"$input\" got invalid value {\"subject\":\"test\",\"description\":\"desc1\",\"status\":\"OPEN\",\"priority\":\"MEDIUM\",\"inbound_mailbox_id\":1,\"ticketable_type\":\"Account\",\"ticketable_id\":1879,\"ticket_group_id\":66,\"ticket_recipients\":{\"email_address\":\"myemail@gmail.com\",\"name\":\"test name\"}}; Expected type CreateTicketRecipientDuringTicketCreationMutationInput to be an object at value.ticket_recipients.name."
    }
  ]
}

ticket_recipients must be an array, as indicated by the API docs

"ticket_recipients": [{
  "email_address": "my@email.com",
  "name":  "My Name" 
}]
1 Like