Re: Definitive list of carrier encodings for the fulfillmentCreat GraphQL API call

Definitive list of carrier encodings for the fulfillmentCreat GraphQL API call

IGIT
Shopify Partner
44 0 10

We're struggling to get the Fulfillment GraphQL to correctly transmit the carriers to Shopify.

 

Is there a definitive list of carrier encoding to sue in the trackingCompany field of the fulfillmentCreate GraphQL API call?

 

The one we're having most trouble with is DHL which give the following

 

What we're sendingWhat Shopify is showing in orders details
DHLAustralia Post
DHL_EXPRESSPoste Italiane
DHL ExpressAustralia Post
DHL eCommerce 

 

The bottom two rows appear in <https://shopify.dev/api/admin-rest/2022-04/resources/fulfillment> but don't appear to work. "DHL_EXPRESS" appears in the orders as "Poste Italiane" is not in that list, so how does Shopify translate DHL_EXPRESS to "Poste Italiane"? We also use Colissimo and using this as the carrier works, but Colissimo is also not in the API published list.

Replies 11 (11)

JamesG
Shopify Staff
42 10 11

Hey @IGIT 

The FulfillmentTrackingInput.company for the fulfillmentCreateV2 mutation takes a String as an argument, so you should be able to add any tracking company name there.

 

I was able to add custom text to that field on new Fulfillments, but do you have an example of how you are creating these fulfillments and/ or an X-Request-Id value for a fulfillmentCreateV2 that failed to add the correct tracking company name?

 

24-31-ft747-56840

 

 

JamesG | API Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

IGIT
Shopify Partner
44 0 10

Hi James, many thanks for your reply. We are still using the GraphQL version, as in:

mutation { 
fulfillmentCreate(
input: {
orderId: "gid://shopify/Order/4xxxxxxxxxxxx2",
locationId: "gid://shopify/Location/1xxxxxxxxxxx2",
notifyCustomer: true,
trackingNumbers: "9xxxxxxxxxxxxxxxxxxxxxxxx1",
trackingCompany: "USPS"
}
)
{
fulfillment { id }
order { id }
userErrors {
field
message
}
}
}

 We're yet to migrate to this new API. Will we have to migrate to get this to work?

IGIT
Shopify Partner
44 0 10

Both v1 and v2 now trigger an OAUTH web page, what's happened? How do you make this work with an automatic call from our server to you, or indeed from Postman? Why is it asking me to login?

JamesG
Shopify Staff
42 10 11

Hi @IGIT 

We can't provide authenticated support in the forums, but if you are hitting an Oauth page when attempting to use fulfillmentCreateV2 then I would recommend checking if your app has correct scopes for a FulfillmentService or Order Managing app, depending on your use case. 

The fulfillmentCreate mutation has also been deprecated so if you haven't already migrated to using fulfillmentOrders I would recommend doing that too.

Once that is done, this is the format I used with the 
fulfillmentCreateV2 mutation from my FulfillmentService app to add custom fulfillment.trackingInfo.company names to my fulfillments:


mutation fulfillmentCreateV2($fulfillment: FulfillmentV2Input!) {
  fulfillmentCreateV2(fulfillment: $fulfillment) {
    fulfillment {
      id
    }
    userErrors {
      field
      message
    }
  }
}


{
  "fulfillment": {
    "trackingInfo": {
      "number": "123",
      "company": "Baz Fulfillments"
    },
    "lineItemsByFulfillmentOrder":[{
        "fulfillmentOrderId": "gid://shopify/FulfillmentOrder/**********",
        "fulfillmentOrderLineItems": {
          "id": "gid://shopify/FulfillmentOrderLineItem/**********",
          "quantity": 1
        }
      }
    ]
  }
}



JamesG | API Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

IGIT
Shopify Partner
44 0 10

Hi James,

 

The auth issue started happening as soon as we permitted developer permissions. We needed to do this, as you say, to grant the correct scopes, but this hasn't fixed to auth problem. This was / is an old private app and we haven't changed anything around the keys, but I'm guessing something changed with it's permissions. Do you have a migration plan at all? Is there something we need to do to just get the current app back up and running?

 

Is it no longer possible to run these requests using Postman, or is there a collection I can download from somewhere?

IGIT
Shopify Partner
44 0 10

It looks like our script itself is still working, which is a relief. It may just be Postman, but I don't know how to get Postman beyond the OAUTH web page. How do I reauthorise in Postman.

IGIT
Shopify Partner
44 0 10

Aaarrggggh!!! It was cookies in Postman, perhaps that should be detailed in one of the guides?

IGIT
Shopify Partner
44 0 10

Hi James,

 

Basic 101 question here, but in your example above is $fulfillment the block of text at the bottom. Also, why do you have

mutation fulfillmentCreateV2($fulfillment: FulfillmentV2Input!) {
  fulfillmentCreateV2(fulfillment: $fulfillment) {

when I have

mutation { 
fulfillmentCreate(
input: {

 ?

Is yours using a GraphQL variable, while our is encoding it directly?

IGIT
Shopify Partner
44 0 10

Getting somewhere, slowly. The response is "Field 'fulfillmentCreateV2' is missing required arguments: fulfillment". We are sending:

mutation { 
    fulfillmentCreateV2( 
        input: { 
            fulfillment: {
                notifyCustomer: false,
                trackingInfo: {
                    company: "my-shipping-company",
                    number: "1562678",
                    url: "https://www.my-shipping-company.com"
                },
                lineItemsByFulfillmentOrder: [
                    {
                        fulfillmentOrderId: "gid://shopify/Order/4xxxxxxxxxxxx2"
                    }
                ]
            }
            orderId: "gid://shopify/Order/4xxxxxxxxxxxx2", 
            locationId: "gid://shopify/Location/1xxxxxxxxxxxxxx2", 
            notifyCustomer: false 
        } 
    ) 
    {
        fulfillment {
            id
            status
            trackingInfo {
                company
                number
                url
            }
        }
        userErrors {
            field
            message
        }
    }
}
IGIT
Shopify Partner
44 0 10

Paired it right back to

 

mutation { 
    fulfillmentCreateV2(fulfillment: 
        {
            lineItemsByFulfillmentOrder: 
            {
                fulfillmentOrderId:"gid://shopify/FullfilmentOrder/4xxxxxxxxxxx2"
            },
            notifyCustomer:false 
        }
    ) {
        userErrors {
            field
            message
        }
    }
}

 

and now it gives me

 

{
    "data": {
        "fulfillmentCreateV2": null
    },
    "errors": [
        {
            "message": "invalid id",
            "locations": [
                {
                    "line": 2,
                    "column": 5
                }
            ],
            "path": [
                "fulfillmentCreateV2"
            ]
        }
    ],
    "extensions": {
        "cost": {
            "requestedQueryCost": 11,
            "actualQueryCost": 1,
            "throttleStatus": {
                "maximumAvailable": 1000.0,
                "currentlyAvailable": 999,
                "restoreRate": 50.0
            }
        }
    }
}

 

So now it doesn't like the fulfillmentCreateV2 ?! Is the order ID in v2 different from that in v1?!

IGIT
Shopify Partner
44 0 10

Maybe it doesn't like taking an order ID, what is this fulfillmentOrderID, especially when a query of assignedFulfillmentOrders returns the error "message": "[\"The api_client is not associated with any fulfillment service.\"]". So how do I get this mysterious fulfillmentOrderID when we don't appear to use any fulfilment service?! This is surely harder than it needs be?!