When a customer wants to buy some goods but hasn’t paid, the owner can create a draft order instead of letting the customer create the order by themself as usual. When the owner accepts the payment, the draft order becomes real.
Draft orders are usually created when the customer purchases through the phone or wants to pick up products at the store. This is why the owner usually adds a note to the draft order. Instead of adding it manually, today, Beehexa will show all of you guys how to add a note to the draft order using Postman with Shopify API, which is faster and more efficient.
Now, letโs explore this subject a little deeper.
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.ย
Shopify Freshdesk Integration
Shopify Close Integration
Shopify Sage Integration
Step 2: Add a note to the draft order using Postman
Before adding a note to the draft order, you need to get a draft_order_id, because this parameter will be included in the next call.ย
Following these steps to get the draft_order_id:
ย
-
- From the Shopify admin.
-
- Go to โOrdersโ.
-
- Then choose โDraftsโ.
-
- Click on the draft order if you want to get the ID.
-
- Copy the draft_order_id in the URL.
In this case, Beehexa has the draft_order_id=878336999487
As you can see, there are no notes on this draft order yet.
We are ready to add a note to the draft order using Postman with Shopify API.ย
ย
-
- Log in to your Postman and create a new workspace
-
- Create a new PUT 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/draft_order_id}:
https://ed86d512a2c95387ffa25f67074a222b:[email protected]/admin/api/2021-10/draft_orders/878336999487.json
ย
-
- Paste the URL above.
In the body section, enter the code.
{
"draft_order": {
"Id": 878336999487,
"note": "Customer contacted us about a custom engraving on this iPod"
}
}
Note: You can change the content of the note in the body section.ย
ย
-
- Then click Send
Response:
The API will return the data like this.ย
{
"draft_order": {
"id": 878336999487,
"note": "Customer contacted us about a custom engraving on this iPod",
"email": "[email protected]",
"taxes_included": false,
"currency": "AUD",
"invoice_sent_at": "2022-03-03T11:16:18+09:00",
"created_at": "2022-02-28T13:14:48+09:00",
"updated_at": "2022-06-29T19:14:49+09:00",
"tax_exempt": false,
"completed_at": null,
"name": "#D68",
"status": "invoice_sent",
"line_items": [
{
"id": 57418238132287,
"variant_id": 39593985409087,
"product_id": 4916307230783,
"title": "Beehexa T-Shirt 2021 New Version 01",
"variant_title": "Yellow",
"sku": "",
"vendor": "hexasync",
"quantity": 1,
"requires_shipping": true,
"taxable": true,
"gift_card": false,
"fulfillment_service": "manual",
"grams": 0,
"tax_lines": [],
"applied_discount": null,
"name": "Beehexa T-Shirt 2021 New Version 01 - Yellow",
"properties": [],
"custom": false,
"price": "1.00",
"admin_graphql_api_id": "gid://shopify/DraftOrderLineItem/57418238132287"
}
],
"shipping_address": {
"first_name": "Yushin",
"address1": "1925 Washington Street",
"phone": "(361) 386-5113",
"city": "Hollywood",
"zip": "33020",
"province": "Florida",
"country": "United States",
"last_name": "Lam",
"address2": "",
"company": "Beehexa",
"latitude": null,
"longitude": null,
"name": "Yushin Lam",
"country_code": "US",
"province_code": "FL"
},
"billing_address": {
"first_name": "Yushin",
"address1": "1925 Washington Street",
"phone": "(361) 386-5113",
"city": "Hollywood",
"zip": "33020",
"province": "Florida",
"country": "United States",
"last_name": "Lam",
"address2": "",
"company": "Beehexa",
"latitude": null,
"longitude": null,
"name": "Yushin Lam",
"country_code": "US",
"province_code": "FL"
},
"invoice_url": "https://hexasync.myshopify.com/25322618943/invoices/41bbf11edd5d004800023891e48ae843",
"applied_discount": null,
"order_id": null,
"shipping_line": null,
"tax_lines": [],
"tags": "",
"note_attributes": [],
"total_price": "1.00",
"subtotal_price": "1.00",
"total_tax": "0.00",
"payment_terms": {
"id": 1536983103,
"payment_terms_name": "Net 7",
"payment_terms_type": "net",
"due_in_days": 7,
"created_at": "2022-03-03T11:20:11+09:00",
"updated_at": "2022-03-03T11:20:11+09:00",
"payment_schedules": [
{
"id": 2562424895,
"created_at": "2022-06-29T13:30:05+09:00",
"updated_at": "2022-06-29T13:30:05+09:00",
"issued_at": "2022-03-03T11:20:08+09:00",
"due_at": "2022-03-10T11:20:08+09:00",
"completed_at": null,
"amount": "1.00",
"currency": "AUD"
}
]
},
"admin_graphql_api_id": "gid://shopify/DraftOrder/878336999487",
"customer": {
"id": 5484387270719,
"email": "[email protected]",
"accepts_marketing": false,
"created_at": "2021-11-08T18:13:34+09:00",
"updated_at": "2022-06-22T00:19:35+09:00",
"first_name": "Hoai",
"last_name": "Lam",
"orders_count": 6,
"state": "enabled",
"total_spent": "200365.20",
"last_order_id": 4498275401791,
"note": null,
"verified_email": false,
"multipass_identifier": null,
"tax_exempt": false,
"phone": null,
"tags": "",
"last_order_name": "#1327",
"currency": "AUD",
"accepts_marketing_updated_at": "2021-11-08T18:13:35+09:00",
"marketing_opt_in_level": null,
"tax_exemptions": [],
"sms_marketing_consent": null,
"admin_graphql_api_id": "gid://shopify/Customer/5484387270719",
"default_address": {
"id": 6925741523007,
"customer_id": 5484387270719,
"first_name": "Hoai",
"last_name": "Lam",
"company": "ABC",
"address1": "2089 Hidden Pond Road",
"address2": "",
"city": "Vanleer",
"province": "Tennessee",
"country": "United States",
"zip": "37181",
"phone": "6157634093",
"name": "Hoai Lam",
"province_code": "TN",
"country_code": "US",
"country_name": "United States",
"default": true
}
}
}
}
Step 3: Verify the result
After adding a note to the draft order, you can verify the result.ย
ย
-
- From the Shopify admin.
-
- Go to โOrdersโ.
-
- Then choose โDraftsโ.
-
- Click on the draft order if you want to verify the result.ย
-
- Scroll down to the note section.
As you can see, the note has been added to the draft order.ย
The above are all steps to add a note to a draft order 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!