Shopify API - How to add a note to a draft order using Postman

Shopify API – How to add a note to a draft order using Postman

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 a real order.

Draft orders are usually created when the customer makes a purchase through the phone, or they want to pick up products at the store. This is a reason 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, 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 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: 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 you want to get the ID.
  • Copy the draft_order_id in the URL.
get a draft order id in shopify
Shopify API - How to add a note to a draft order using Postman 7

In this case, Beehexa has the draft_order_id=878336999487

As you can see, there are no notes on this draft order yet.

Shopify API - How to add a note to a draft order using Postman_no note
Shopify API - How to add a note to a draft order using Postman 8

Now, 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
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/draft_order_id}:

https://ed86d512a2c95387ffa25f67074a222b:[email protected]/admin/api/2021-10/draft_orders/878336999487.json
Code language: JavaScript (javascript)
  • Paste the URL above.
Shopify API - How to add a note to a draft order using Postman_put
Shopify API - How to add a note to a draft order using Postman 9

In the body section, enter the code.

{ "draft_order": { "Id": 878336999487, "note": "Customer contacted us about a custom engraving on this iPod" } }
Code language: JSON / JSON with Comments (json)

Note: You can change the content of the note in the body section. 

  • Then click Send
Shopify API - How to add a note to a draft order using Postman_body
Shopify API - How to add a note to a draft order using Postman 10

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 } } } }
Code language: JSON / JSON with Comments (json)
Shopify API - How to add a note to a draft order using Postman_response
Shopify API - How to add a note to a draft order using Postman 11

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 you want to verify the result. 
  • Scroll down to the note section.
Shopify API - How to add a note to a draft order using Postman_noted
Shopify API - How to add a note to a draft order using Postman 12

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 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 add a note to a draft order using Postman

Hopefully, you can do it!