Shopify_API_How_to_retrieve_a_list_of_draft_orders_using_Postman

Shopify API – How to retrieve a list of draft orders using Postman

The draft order is a draft version of an order that the owner can create when the customer wants to buy some products but doesn’t pay yet. It is an order you make for your customer, instead of creating it by themselves. The draft order is converted to an order when the owner accepts payment.

Sometimes the owner needs to know some parameters of the draft orders, or basically, they want to know what products were purchased as draft orders. This is a reason, Beehexa will so you how to retrieve a list of draft orders using Postman with Shopify API.

Now, let’s explore this subject step by step.

If this is the first time you make a call in the Postman, you must generate API credentials from the Shopify admin

Step 1: Generate API credentials from Shopify Admin

Follow the process in How to build a custom app for Shopify in 2022? to know how to access Shopify API. 

  • After creating an app, remember the Admin API access token and the API key to send requests in the Postman. 

Step 2: Retrieve a list of draft orders using Postman

Now, you can get all draft orders with Shopify API. 

  • Log in to your Postman and create a new workspace
  • Create a new GET with this URL:
https://{API_key}:{admin_API_access_token}@{shop}.myshopify.com/admin/api/{api-version}/{resource}.json
Code language: JavaScript (javascript)
  1. {API_key} – The API key that you generated.
  2. {admin_API_access_token} – The admin API access token that you generated.
  3. {shop} – The name of your development store.
  4. {api-version} – The supported API version that you want to use.
  5. {resource} – A resource endpoint from the REST Admin API.

Or you can copy this example, remember to change {resource} to {draft_orders}:

https://ed86d512a2c95387ffa25f67074a222b:[email protected]/admin/api/2021-10/draft_orders.json
Code language: JavaScript (javascript)
  • Paste the URL above.
Shopify API - How to retrieve a list of draft orders using Postman
Shopify API - How to retrieve a list of draft orders using Postman 3
  • Then click Send

Response:

The API will return all draft order information.

{ "draft_orders": [ { "id": 510691246143, "note": "", "email": "", "taxes_included": false, "currency": "VND", "invoice_sent_at": null, "created_at": "2019-11-14T18:12:09+09:00", "updated_at": "2019-11-14T18:15:38+09:00", "tax_exempt": false, "completed_at": null, "name": "#D1", "status": "open", "line_items": [ { "id": 54588271558719, "variant_id": 31179526766655, "product_id": 4356058677311, "title": "Arai Black Helmet", "variant_title": null, "sku": "CONHELMET1", "vendor": "hexasync", "quantity": 1, "requires_shipping": true, "taxable": true, "gift_card": false, "fulfillment_service": "manual", "grams": 0, "tax_lines": [ { "rate": 0.1, "title": "VAT", "price": "53" } ], "applied_discount": null, "name": "Arai Black Helmet", "properties": [], "custom": false, "price": "657", "admin_graphql_api_id": "gid://shopify/DraftOrderLineItem/54588271558719" }, { "id": 54588271591487, "variant_id": 31179494621247, "product_id": 4356042326079, "title": "Caravan Canopy Recliner", "variant_title": null, "sku": "CONCHAIR1", "vendor": "hexasync", "quantity": 1, "requires_shipping": true, "taxable": true, "gift_card": false, "fulfillment_service": "manual", "grams": 0, "tax_lines": [ { "rate": 0.1, "title": "VAT", "price": "5" } ], "applied_discount": null, "name": "Caravan Canopy Recliner", "properties": [], "custom": false, "price": "66", "admin_graphql_api_id": "gid://shopify/DraftOrderLineItem/54588271591487" }, { "id": 54588271624255, "variant_id": 31179517755455, "product_id": 4356051664959, "title": "Char-Broil Classic 480", "variant_title": null, "sku": "CONGRILL", "vendor": "hexasync", "quantity": 1, "requires_shipping": true, "taxable": true, "gift_card": false, "fulfillment_service": "manual", "grams": 0, "tax_lines": [ { "rate": 0.1, "title": "VAT", "price": "16" } ], . . . .
Code language: JavaScript (javascript)
Shopify API - How to retrieve a list of draft orders using Postman
Shopify API - How to retrieve a list of draft orders using Postman 4

The above are all steps to retrieve a list of draft orders using Postman with Shopify API. If you have any questions about Shopify draft orders API, let us know in the comment below or refer to our Shopify API integration.

These steps will be shown visually in the video below. Click on the video for watching more about the Shopify API tutorial. 

Shopify API – How to retrieve a list of draft orders using Postman

Hopefully, you can do it!