Today, Beehexa will show you how to retrieve a list of draft orders using Postman with Shopify API.
The draft order is a draft version 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 alone. 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 they want to know what products were purchased as draft orders.
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 of 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
-
- {API_key} – The API key that you generated.
-
- {admin_API_access_token} – The admin API access token that you generated.
-
- {shop} – The name of your development store.
-
- {api-version} – The supported API version that you want to use.
-
- {resource} – A resource endpoint from the REST Admin API.
Or you can copy this example, remember to change {resource} to {draft_orders}:
https://ed86d512a2c95387ffa25f67074a222b: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@hexasync.myshopify.com/admin/api/2021-10/draft_orders.json
-
- Paste the URL above.
-
- 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"
}
],
.
.
.
.
The above are all steps to retrieve a list of draft orders using Postman with Shopify API. If you have 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 to watch more about the Shopify API tutorial.
Hopefully, you can do it!