Create Order error graphql

Hi everyone,

I’m just getting my head around graphql so please excuse my lack of knowledge.

I’m trying to create an order and my mutation is below:

mutation {
order_create(
data: {
order_number: “1122334530001”
shop_name: “ExampleShop”
fulfillment_status: “pending”
order_date: “2020-09-15”
total_tax: “29.00”
subtotal: “150.00”
total_discounts: “20.00”
total_price: “159.00”
shipping_lines: {
title: “UPS”
price: “0.00”
carrier: “UPS”
method: “Ground”
}
shipping_address: {
first_name: “John”
last_name: “Johnson”
company: “The Johnson Co”
address1: “2543 Duck St.”
address2: “Apt. 2”
city: “Oklahoma”
state: “Oklahoma”
state_code: “OK”
zip: “73008”
country: “US”
country_code: “US”
email: “johnjohnsonco@johnsonco.com
phone: “5555555555”
}
billing_address: {
first_name: “John”
last_name: “Johnson”
company: “The Johnson Co”
address1: “2543 Duck St.”
address2: “Apt. 2”
city: “Oklahoma”
state: “OK”
state_code: “OK”
zip: “73008”
country: “US”
country_code: “US”
email: “johnjohnsonco@johnsonco.com
phone: “5555555555”
}
line_items: {
sku: “6H-J219-YMQK”
partner_line_item_id: “1122334530001”
quantity: 2
price: “150.00”
product_name: “Example Product”
fulfillment_status: “pending”
quantity_pending_fulfillment: 2
warehouse_id: “QWNjb3VudDo1MzM1OA==”
}
required_ship_date: “2020-09-15”
}
) {
request_id
complexity
order {
id
order_number
shop_name
fulfillment_status
order_date
total_tax
subtotal
total_discounts
total_price
custom_invoice_url
account_id
email
profile
packing_note
required_ship_date
shipping_address {
first_name
last_name
company
address1
address2
city
state
state_code
zip
country
country_code
email
phone
}
line_items(first: 1) {
edges {
node {
id
sku
product_id
quantity
product_name
fulfillment_status
quantity_pending_fulfillment
quantity_allocated
backorder_quantity
eligible_for_return
customs_value
warehouse_id
locked_to_warehouse_id
}
}
}
}
}
}

The error returned is: {“message”: “Unexpected error. Please contact a system administrator.”}

I’m finding it hard to debug as there is so little information returned.

I’m successfully generating the access token as I can successfully make GET requests to graphql just not POST for some reason ( * assuming it’s my mutation that’s the issue )

Any help would be awesome!!

Hi @alfieandgem

Your query looks fine. I got expected result.
May be, issue is in headers section. Pls Double check them.

Suggestions:
Try using following query and see whether you are getting any response, I am too new to graphql, initially I faced issue which you are mentioned.

mutation {

  order_create(

    data: {

      order_number: "11243"

      fulfillment_status: "pending"

      order_date: "2019-07-29"

      total_tax: "29.00"

      subtotal: "150.00"

      total_discounts: "20.00"

      total_price: "159.00"

      shipping_address: {

        first_name: "John"

        last_name: "Johnson"

        company: "The Johnson Co"

        address1: "2543 Duck St."

        address2: "Apt. 2"

        city: "Oklahoma"

        state: "Oklahoma"

        state_code: "OK"

        zip: "73008"

        country: "US"

        country_code: "US"

        email: "johnjohnsonco@johnsonco.com"

        phone: "5555555555"

      }

      line_items: [

      {

        sku: "6H-J219-YMQK"

        partner_line_item_id: "31546"

        quantity: 1

        price: "150.00"

        product_name: "Example Product"

        fulfillment_status: "pending"

      }

      ]

      required_ship_date: "2019-08-29"

    }

  ) {

    request_id

    complexity

    order {

      id

      order_number

    }

  }

  }

Try using postman, it is easier.
If you try postman, just put above query in GraphQl section at Body, Bearer token value at Headers and try sending.

thanks!!! Let me know, If you need detailed clarifications.

Thanks @velvinayak :slight_smile: