Shipment Create Mutation is not working

Hello Everyone, I’m trying to create a shipment using the shipment_create mutation but I’m getting the error, address is invalid. I also tried different addresses but all time I have the same error. Following is the link that I’m following to create a shipment.
https://developer.shiphero.com/order-fulfillment/

my mutation looks like below

mutation($data: CreateShipmentInput!) {
  shipment_create(data: $data) {
    request_id
    complexity
    shipment{
      id
    }
  }
}

and the variables are as follows

{
  "data": {
      "customer_account_id": "QWNj........",
      "order_id": "T3JkZX.............",
  "warehouse_id": "V2FyZWhvd......",
  "address": {
    "name": "John",
    "address1": "2543 Johnson St.",
    "address2": "",
    "city": "Oklahoma",
    "country": "US",
    "phone": "5555555555"
  },
  "line_items": [{ "line_item_id": "TGluZUl0ZW06NDA5MjA2ODkw", "quantity": 1 }],
  "labels": {
    "address": {
    "name": "John",
    "address1": "2545 Johnson St.",
    "address2": "",
    "city": "lo",
    "country": "US",
    "phone": "5555555555"
    },
    "carrier": "Generic",
    "shipping_name": "Generic",
    "shipping_method": "Generic",
    "cost": "0.00",
    "dimensions": { "weight": "0", "height": "0", "width": "0", "length": "0" },
    "label": {
      "paper_pdf_location": "https://ws.aramex.net/content/rpt_cache/b2878efbeb6c48bd8c9bdc364cff5882.pdf"
    },
    "line_item_ids": ["TGluZUl0ZW06NDA5MjA2ODkw"],
    "tracking_number": "1234434242444444434"
  },
  "notify_customer_via_shiphero": true,
  "notify_customer_via_store": true
  }
}

I’m getting the following error

{
  "errors": [
    {
      "message": "Variable \"$data\" got invalid value {\"address\": {\"address1\": \"2543 Johnson St.\", \"address2\": \"\", \"city\": \"Oklahoma\", \"country\": \"US\", \"name\": \"John\", \"phone\": \"5555555555\"}, \"customer_account_id\": \"QWNjb3VudDo2MjczMQ==\", \"labels\": {\"address\": {\"address1\": \"2543 Johnson St.\", \"address2\": \"\", \"city\": \"Oklahoma\", \"country\": \"US\", \"name\": \"John\", \"phone\": \"5555555555\"}, \"carrier\": \"Generic\", \"cost\": \"0.00\", \"dimensions\": {\"height\": \"0\", \"length\": \"0\", \"weight\": \"0\", \"width\": \"0\"}, \"label\": {\"paper_pdf_location\": \"https://ws.aramex.net/content/rpt_cache/b2878efbeb6c48bd8c9bdc364cff5882.pdf\"}, \"line_item_ids\": [\"TGluZUl0ZW06NDA5MjA2ODkw\"], \"shipping_method\": \"Generic\", \"shipping_name\": \"Generic\", \"tracking_number\": \"1234434242444444434\"}, \"line_items\": [{\"line_item_id\": \"TGluZUl0ZW06NDA5MjA2ODkw\", \"quantity\": 1}], \"notify_customer_via_shiphero\": true, \"notify_customer_via_store\": true, \"order_id\": \"T3JkZXI6MjAxNTYyNDEz\", \"warehouse_id\": \"V2FyZWhvdXNlOjc0NTUw\"}.\nIn field \"labels\": In element #0: Expected \"CreateShipmentShippingLabelInput\", found not an object.\nIn field \"labels\": In element #1: Expected \"CreateShipmentShippingLabelInput\", found not an object.\nIn field \"labels\": In element #2: Expected \"CreateShipmentShippingLabelInput\", found not an object.\nIn field \"labels\": In element #3: Expected \"CreateShipmentShippingLabelInput\", found not an object.\nIn field \"labels\": In element #4: Expected \"CreateShipmentShippingLabelInput\", found not an object.\nIn field \"labels\": In element #5: Expected \"CreateShipmentShippingLabelInput\", found not an object.\nIn field \"labels\": In element #6: Expected \"CreateShipmentShippingLabelInput\", found not an object.\nIn field \"labels\": In element #7: Expected \"CreateShipmentShippingLabelInput\", found not an object.\nIn field \"labels\": In element #8: Expected \"CreateShipmentShippingLabelInput\", found not an object.",
      "locations": [
        {
          "line": 1,
          "column": 10
        }
      ]
    }
  ]
}

Hi @JMMTech ,
Please try again where the address checks against ZIP Code™ Lookup | USPS as valid. If it is still giving you an error with the valid address, post the request id and we can take a closer look.
Best,
Theresa

@Theresa thanks for your kind response.
Can you please let me know what is the request id?? If the request is successful then we get the request id but in case of request is failed we don’t have any request id.

I have tried the following US address and confirmed from the link you shared in the comment above,

  "name": "John",
          "address1": "17906 Village Branch Ln",
          "address2": "",
          "city": "HOUSTON",
          "state": "TX",
          "zip": "77407",
          "country": "US",
          "phone": "+12813938447"

But still, I have the following error

message": "Variable \"$data\" got invalid value

But, in our case, we will not use US-based addresses. We want to use Saudi Arabia addresses, can you please guide or let us the way how we can use our Saudi Arabia address to create a shipment using shipment_create mutation.

@Theresa below is the screenshot and in the middle column you can see the error object,
I’m also attaching the whole error object

{
  "errors": [
    {
      "message": "Variable \"$data\" got invalid value {\"address\": {\"address1\": \"17906 Village Branch Ln\", \"address2\": \"\", \"city\": \"HOUSTON\", \"country\": \"US\", \"name\": \"John\", \"phone\": \"+12813938447\", \"state\": \"TX\", \"zip\": \"77407\"}, \"customer_account_id\": \"QWNjb3VudDo2MjczMQ==\", \"labels\": {\"address\": {\"address1\": \"17906 Village Branch Ln\", \"address2\": \"\", \"city\": \"HOUSTON\", \"country\": \"US\", \"name\": \"John\", \"phone\": \"+12813938447\", \"state\": \"TX\", \"zip\": \"77407\"}, \"carrier\": \"Generic\", \"cost\": \"0.00\", \"dimensions\": {\"height\": \"0\", \"length\": \"0\", \"weight\": \"0\", \"width\": \"0\"}, \"label\": {\"paper_pdf_location\": \"https://ws.aramex.net/content/rpt_cache/b2878efbeb6c48bd8c9bdc364cff5882.pdf\"}, \"line_item_ids\": [\"TGluZUl0ZW06NDA5MjA2ODkw\"], \"shipping_method\": \"Generic\", \"shipping_name\": \"Generic\", \"tracking_number\": \"1234434242444444434\"}, \"line_items\": [{\"line_item_id\": \"TGluZUl0ZW06NDA5MjA2ODkw\", \"quantity\": 1}], \"notify_customer_via_shiphero\": true, \"notify_customer_via_store\": true, \"order_id\": \"T3JkZXI6MjAxNTYyNDEz\", \"warehouse_id\": \"V2FyZWhvdXNlOjc0NTUw\"}.\nIn field \"labels\": In element #0: Expected \"CreateShipmentShippingLabelInput\", found not an object.\nIn field \"labels\": In element #1: Expected \"CreateShipmentShippingLabelInput\", found not an object.\nIn field \"labels\": In element #2: Expected \"CreateShipmentShippingLabelInput\", found not an object.\nIn field \"labels\": In element #3: Expected \"CreateShipmentShippingLabelInput\", found not an object.\nIn field \"labels\": In element #4: Expected \"CreateShipmentShippingLabelInput\", found not an object.\nIn field \"labels\": In element #5: Expected \"CreateShipmentShippingLabelInput\", found not an object.\nIn field \"labels\": In element #6: Expected \"CreateShipmentShippingLabelInput\", found not an object.\nIn field \"labels\": In element #7: Expected \"CreateShipmentShippingLabelInput\", found not an object.\nIn field \"labels\": In element #8: Expected \"CreateShipmentShippingLabelInput\", found not an object.",
      "locations": [
        {
          "line": 1,
          "column": 10
        }
      ]
    }
  ]
}

Hi @JMMTech

Can you try it again with the variables in the mutation? It will be a little bit more straight forward to look into. Thanks in advance!

Best,
Theresa

@Theresa I have picked the shipment_create mutation from the following link
https://developer.shiphero.com/order-fulfillment/

and placed the values using variables and even I haven’t removed any attribute from the following code snippet, the code snippet below is also taken from the above link

mutation {
  shipment_create(
    data: {
      order_id: "T3JkZXI6MTQzNDE2NDY3"
      warehouse_id: "V2FyZWhvdXNlOjExNzkw"
      address: {
        name: "John"
        address1: "2543 Johnson St."
        address2: "Apt. 2"
        city: "Oklahoma"
        state: "Oklahoma"
        zip: "73008"
        country: "US"
        phone: "5555555555"
      }
      line_items: { line_item_id: "TGluZUl0ZW06NDA5MjA2ODkw", quantity: 1 }
      labels: {
        address: {
          name: "John"
          address1: "2543 Johnson St."
          address2: "Apt. 2"
          city: "Oklahoma"
          state: "Oklahoma"
          zip: "73008"
          country: "US"
          phone: "5555555555"
        }
        carrier: "UPS"
        shipping_name: "UPS - Ground"
        shipping_method: "Ground"
        cost: "0.00"
        dimensions: { weight: "12", height: "12", width: "12", length: "12" }
        label: {
          paper_pdf_location: "https://d2kghplsj0vn8x.cloudfront.net/prod/shipping-labels/2020/08/21/6ea5c0ba88f63dbf3eb8d7e6380f1811491d39da902d1d63a4f13af81bd98040/143071030/2fiu8_3c.pdf"
        }
        line_item_ids: "TGluZUl0ZW06NDA5MjA2ODkw"
        tracking_number: "1234434242444444434"
      }
      notify_customer_via_shiphero: true
      notify_customer_via_store: true
    }
  ) {
    request_id
    complexity
  }
}

@Theresa as you can see in the right column, we are following the variables information from there and not using any extra variable

Hello @JMMTech!
Could you please try using a variable for each field instead of sending the whole query as a variable?
Have a nice day!
TomasFD

@tomasfd we are using the Altair tool recommended by the official docs of Ship Hero. If we will declare a mutation in wrong way then the Altair tool will give the error on the spot and will underline that line with red color.

We are not sending the whole query as a variable. Can you please share this code with one of your developer then he will let you know that either we are doing wrong or right.

@tomasfd @Theresa will you please give me a response on above? I’m waiting for your response.

Hello @JMMTech!
We are still working on this. I will let you know as soon as I have an update.
Kind regards,
TomasFD

@tomasfd any update??

Hello @JMMTech!
Apologies for the late answer.
Can you try the following for your variable, please?

  {
  "data": {
    "customer_account_id": "QWNj........",
    "order_id": "T3JkZX.............",
    "warehouse_id": "V2FyZWhvd......",
    "address": {
      "name": "John",
      "address1": "2543 Johnson St.",
      "city": "Oklahoma",
      "country": "US",
      "phone": "5555555555"
    },
    "line_items": [{ "line_item_id": "TGluZUl0ZW06NDA5MjA2ODkw", "quantity": 1 }],
    "labels": [{
      "address": {
        "name": "John",
        "address1": "2545 Johnson St.",
        "address2": "",
        "city": "lo",
        "country": "US",
        "phone": "5555555555"
      },
      "carrier": "Generic",
      "shipping_name": "Generic",
      "shipping_method": "Generic",
      "cost": "0.00",
      "dimensions": { "weight": "0", "height": "0", "width": "0", "length": "0" },
      "label": {
        "paper_pdf_location": "https://ws.aramex.net/content/rpt_cache/b2878efbeb6c48bd8c9bdc364cff5882.pdf"
      },
      "line_item_ids": ["TGluZUl0ZW06NDA5MjA2ODkw"],
      "tracking_number": "1234434242444444434"
    }],
    "notify_customer_via_shiphero": true,
    "notify_customer_via_store": true
  }
}

If you didn’t notice, I added the brackets in the labels input, just as you had done with line_items.
When working with nested inputs in variables, the value of the input field should be between brackets.
Please let me know if this doesn’t help.
Have a nice day!
TomasFD