API to access printable packing slip

Highlighted
Tourist
6 0 1

I am trying to write a script which can access the URL for an orders Packing Slip through the Rest API but I cant find any way to get to it.  I don't need any information other than a link to the PDF file that is generated for the order.  Does anyone know a way I can pull in this information?

1 Like
Highlighted
Shopify Partner
6 0 0

I am also interested in that!

0 Likes
Highlighted
Shopify Partner
541 39 110

If you look at the URL that pops up for the printing dialog you'll see it contains a complex array of third party resource ID's, such as Google elements. I definitely don't see this in the REST or GrahpQL API. 

As a workaround you could pull the fields you need via the API, push them into an HTML form, and then utilize a library like https://www.npmjs.com/package/html2pdf.js/v/0.9.0 in order to pop that up as a printing dialog. I know it's a lot simpler just to hook into the existing Shopify routine, but ithe URL isn't as simple as https://{my_shop_name}.myshopify.com/admin/orders/{order_id}/print or anything... 

1 Like
Highlighted
Shopify Partner
6 0 0

Hi Greg,

Thank you for your response, but some of the parameters seem to vary depending on the Shopify account/store.

https://storage.googleapis.com/html2pdf/1_Shopify_7775617137/da69bde65103653fb422d829244c97b96bdfa377f3ff3e02c96e49335880e224/packing_slip.pdf?GoogleAccessId=html2pdf-production%40shopify-applications.iam.gserviceaccount.com&
Expires=1597258256&
Signature=Sa4Bb3ZYq4WUzDnvxISQIGX%2BkoL4fWj2aspIteCIS6E6gFvLJ%2BSxVIWu2sjZdeKTABD4yYM6l2fa6vVEPRcBA0g9wBefV3BJlgVcwoyEDk9134SxrTv05JIzm3O2pyaOmPic%2BkBsIgHaWa8xyBiOOsvlSMWAytFUtgBX%2FS9Bn7HCGVDey9B10isk9xBaEObY691bbe29DpL6f6L5q%2Fv810Nh96D1OWKWKlmEecva%2FQg8sBgmGCUHCMlax%2BgV1XHDOGCZx6NyeZdhl%2BGA1G%2F5bQKbaEXpZIoTiCaXZygUwt5y7pIjR%2FBVKxet2LzuFtsSSkXBfCMw4HHTxnB4nAZrbQ%3D%3D&
response-content-disposition=inline%3B+filename%3D%22packing_slip.pdf%22%3B+filename%2A%3DUTF-8%27%27packing_slip.pdf&
response-content-type=application%2Fpdf
https://storage.googleapis.com/html2pdf/1_Shopify_7289634885/1695f6c1c5bccbd54173c36a1b6721dcacc82bd2a3c0b6d28164a695a29174a9/packing_slip.pdf?GoogleAccessId=html2pdf-production%40shopify-applications.iam.gserviceaccount.com&
Expires=1597258366&
Signature=aWvBW8s5Iosm4R9U5%2BPOBsFwoO7iV%2B%2FbyhOAjaAvolwXjGh7FNiw%2BG%2FsKbvlrlxJR6kVM4RlxhrwfSJrIgYybB4BpyPZA0b9H0OkQVWSrIIWEZDw6djpgNbFS7keQc3YOrlDQuGZGpejuyEerld1%2BZ6zMvj8cJY1gRBIujPxbJEvcsJOBr7z5CQyaMoLdUsIbcUoqhJE9bzAr%2Fj%2Bkgvn9GGC%2F0LQONnxtPySb49OkpD%2BrX6JlVCeDlvYqlZVCAkBalUuJLgyqpmuDyCEcWWsLA9RynesJY5gDG%2B7X1V9B5S%2FQdUEN5%2FXL8uQ3Zht8dpaTPFfuH%2FF82Air42CMuciaw%3D%3D&
response-content-disposition=inline%3B+filename%3D%22packing_slip.pdf%22%3B+filename%2A%3DUTF-8%27%27packing_slip.pdf&
response-content-type=application%2Fpdf

I was looking for an API-like solution to access the URL, fetch the pdf and store it.

 

0 Likes
Highlighted
Shopify Partner
6 0 0

Hi Greg,

Thank you for your response, but the URL parameters change depending on the Shopify store.

We are a logistics company and some of our clients want to use Shopify's packing slip to include it in their shipments.

However, asking merchants for this URL when setting the integration does not feel like something very integrated.

 

0 Likes
Highlighted
Shopify Partner
541 39 110

If you are planning on rolling this integration out to multiple clients it might make sense to have a public app developed. If it's just a smaller set of clients then I suppose a private app would work for each of them.

One idea would be to have a webhook setup for FulfillmentEvent triggers --> https://shopify.dev/docs/admin-api/rest/reference/events/webhook?api[version]=2020-07. The webbook would send over pertinent details and you could take those to query the order line details and create a printable packing slip. But regardless of the mechanisms that are employed, without API access via an app I can't see how this would be doable.

If any other folks would like to chime in, that'd be welcomed as well. 

0 Likes
Highlighted
Shopify Partner
6 0 0

Hi Greg,

We do have an integration developed, we work with private apps(we are looking into switching to custom apps) and we also make use of webhooks. This is all working.

Now with all that in place, we want to retrieve the URL of the generated packing slip.

 

 

0 Likes