Need graphql query for create shippment

hello team i need graphql query for create shippment.i have read shiphero graphql documentation but can’t find this api so can you please help me.thanks in advance.

Hi @madhupatel!
This should be under Mutations —> shipment_create

And the mutation should look something like this:

mutation {
  shipment_create(
    data: {
      order_id: "100516111”
      warehouse_id: "V2FyZWhvdu2NlOjY1NDU="
      address: {
        name: "John"
        address1: “123 Test St."
        address2: "Apt. 2"
        city: "Oklahoma"
        state: "Oklahoma"
        zip: "73001”
        country: "US"
        phone: "5555555555"
      }
      line_items: { line_item_id: "293811638", quantity: 1 }
      labels: {
        address: {
          name: "John"
          address1: “123 Test St."
          address2: "Apt. 2"
          city: "Oklahoma"
          state: "Oklahoma"
          zip: "73001”
          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: “testurl.com"
          thermal_pdf_location: “testurl.com"
          pdf_location: “testurl.com"
        }
        line_item_ids: "293811638"
        tracking_number: "123443144434"
      }
      notify_customer_via_shiphero: true
      notify_customer_via_store: true
    }
  ) {
    request_id
    complexity
    shipment {
      id
      legacy_id
      order_id
      user_id
      warehouse_id
      pending_shipment_id
      address {
        name
        address1
        address2
        city
        state
        country
        zip
        phone
      }
      picked_up
      needs_refund
      refunded
      delivered
      shipped_off_shiphero
      dropshipment
      created_date
      line_items(first: 2) {
        edges {
          node {
            id
            line_item_id
            quantity
          }
        }
      }
    }
  }
}

Let me know if this is not what you were looking for,
Thanks!
Tom

i need 1 more graph ql query for order update .in order i want to update following fields (
Tracking Number, Tracking URL , Tracking Label ,carrier, label url ,shipment cost ).
can you please provide query for that.

Hi @madhupatel!
For that type of fields such as Tracking Number, carrier or shipment cost they will have to be specified on the shipment and not the order, as they are associated with a Shipment. For those you could use the mutation above.
As for Label URL you can also use the mutation above and set that part inside label.
Let me know if this doesn’t help or I should explain better,
Thanks again!
Tom

hey tomas thanx for response , i have one more query, i am using create shipment graph ql api it’s giving me success json .after creating shipment my order status is not changed to shipped ,so i am quite confused whats wrong can you please explain me.

Yes absolutely, then you could make the following mutation to change the order status:

mutation{
  order_update_fulfillment_status(data: {
    order_id:"100516111"
    fulfillment_status:"fulfilled",
    remove_inventory:true
  }){
    request_id
    complexity
  }
}

Specifying if you would like to remove inventory or not

can you please provide me query for, update order line item fulfillment status and line item shipped quantity.

@ tomasw i am trying to create shipment for my order .my order status is shown shipped but their line item shipment status is showing pending and also line item shipped quantity is 0.

if you provide field for shipped quantity and shipment status field(create shipment line item ) it’s
very helpful for me.

Hi @madhupatel!
As for quantity_shipped, that field is for quantities shipped in ShipHero (using the app). It is not accessible via the API.
The shipment_create mutation doesn’t replicate shipping in ShipHero, it is a way to add shipment info for shipments made off ShipHero either in another warehouse or before ShipHero was implemented. It doesn’t remove stock and doesn’t increment quantity shipped.
If you would like to change the status of the line items you will have to use the order_update_line_items mutation, something like this:

mutation {
  order_update_line_items(
    data: {
      order_id: "117384888"
      line_items: {
        id: "TGluZUl0ZW06MzQzMz1zNDA1"
        partner_line_item_id: "MO721-282170272"
        quantity_pending_fulfillment: 0
        fulfillment_status:"fulfilled"
      }
    }
  ) {
    request_id
    complexity
    order {
      id
      legacy_id
      order_number
      partner_order_id
    }
  }
}

hi @tomasw
my purpose of doing all above steps is, show my order in shipment section under report in shiphero dashboard.
but after doing all above steps my order still not shown in shipment section, line item shipment quantity is also not changed may be that’t the reason.can you please suggest me what i am doing wrong, and what i need to do .please check the attachment for more info.

order number (MO-0012)

Hi @madhupatel!
Unfortunately, that is for shipments created in ShipHero, and not using the API to ship outside.
We did have another thread about this where a similar discussion took place, in case it helps provide more context to this:

I hope it helps clarify the functionality of shipping using the API, but let me know if it doesn’t.
Thanks again!