Home > Mobile >  What is this mean in GrqphQL Expected type '[OrderCreationNotificationEnum!]
What is this mean in GrqphQL Expected type '[OrderCreationNotificationEnum!]

Time:10-28

I have a service who provided me api to use and they are using GraphQL.

Everything else seems working fine apart from this section.

I'm using the following query to create an order and it's working fine apart from when I add notifications in there

I'm getting this error Argument 'notifications' on InputObject 'OrderCreateMutationInput' has an invalid value ({type: {OrderCreationNotificationEnum: {email: true}}}). Expected type '[OrderCreationNotificationEnum!]'

mutation{
orderCreate(input: {
order: {
  externalIds:[
    {key: "VRPOrderId", value: "abc131"}
  ]
  firstName: "John"
  surname: "Doe"
  phone: "0405123456"
  billingFirstName: "John"
  billingSurname: "Doe"
  
  billingEmailAddress: "[email protected]"
  address: {
    address: "1 Bourke Street"
      city: "Melbourne"
      country: {
        code: "AU"
      }
      postcode: "3000"
      state: {
        short: "VIC"
      }
  }
  billingAddress:{
    address: "1 Bourke Street"
      city: "Melbourne"
      country: {
        code: "AU"
      }
      postcode: "3000"
      state: {
        short: "VIC"
      }
  }
  termsAndConditionsAccepted: true
  
}
lineItems: [
  {             
    variantId: "VmFyaWFudC00NzMz"
    quantity: 1
    totalCents: 22500
    postageCents: 1000
    
  },
  {             
    variantId: "VmFyaWFudC00NzYy"
    quantity: 1
    totalCents: 22500
    postageCents: 500
    
  }
]
notifications:
{
    type: {
        OrderCreationNotificationEnum: {
            email: true
        }
    } 
}

})
{
order{
  id
  invoices{
    edges{
      node{
        id
        lineItems{
          id
          quantity
        } 
      }  
    }
  }
}
 status
}
}

I am struggling to get the notification working. I'm adding link for the instructions too. Please help.

link to api document

CodePudding user response:

Argument 'notifications' on InputObject 'OrderCreateMutationInput' is an Enum:

enum OrderCreationNotificationEnum {
    # Notify the order information via Email
    EMAIL
    # Notify the order information via SMS
    SMS
}

For notifications, you should specify an array of enum values like this:

notifications: [EMAIL, SMS]
  • Related