Shopify API - How to create a new draft product using Postman

Shopify API 2024 – How to create a new draft product using Postman

In this article, we will talk about how to create a new draft product using Postman.

Don’t confuse the unpublished product with the draft product.

A draft product doesn’t exist in inventory, while an unpublished product is identified in inventory but not yet made public. 

Now, let’s dive into the article to learn how to create a new draft product using Postman in Shopify API. 

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 Connector and Profile arrow Magento
    Shopify Magento Integration
    Shopify Connector and Profile arrow Salesforce
    Shopify Salesforce Integration
    Shopify Connector and Profile arrow Insightly
    Shopify Insightly Integration

    Step 2: Create a new draft product using Postman

    Now we are ready to create a new draft product:

       

        • Log in to your Postman and create a new workspace

        • Create a new POST with this URL:

      https://{API_key}:{admin_API_access_token}@{shop}.myshopify.com/admin/api/{api-version}/{resource}.json

         

          1. {API_key} – The API key that you generated.

          1. {admin_API_access_token} – The admin API access token that you generated.

          1. {shop} – The name of your development store.

          1. {api-version} – The supported API version that you want to use.

          1. {resource} – A resource endpoint from the REST Admin API.

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

        https://ed86d512a2c95387ffa25f67074a222b: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@hexasync.myshopify.com/admin/api/2022-01/products.json

           

            • Paste the URL above.

          create a new draft product

          In the body section, enter the code:

          {
              "product": {
                  "title": "Burton Custom Freestyle 151",
                  "body_html": "\u003cstrong\u003eGood snowboard!\u003c\/strong\u003e",
                  "vendor": "Burton",
                  "product_type": "Snowboard",
                  "status": "draft"
              }
          }

          body_create a new draft product

          Parameters: 

             

              • product.title:”Burton Custom Freestyle 151″: The name of the product.

              • product.body_html:”<strong>Good snowboard!</strong>”: A description of the product. Supports HTML formatting.

              • product.vendor:”Burton”:  The name of the product’s vendor.

              • product.product_type:”Snowboard”: A categorization for the product used for filtering and searching products.

              • Product.status:”draft”: The status of the product

            Then click Send

            Response:

            The API will return the new draft product information.

            {
                "product": {
                    "id": 6939083112511,
                    "title": "Burton Custom Freestyle 151",
                    "body_html": "<strong>Good snowboard!</strong>",
                    "vendor": "Burton",
                    "product_type": "Snowboard",
                    "created_at": "2022-05-10T10:51:22+09:00",
                    "handle": "burton-custom-freestyle-151",
                    "updated_at": "2022-05-10T10:51:22+09:00",
                    "published_at": null,
                    "template_suffix": null,
                    "status": "draft",
                    "published_scope": "web",
                    "tags": "",
                    "admin_graphql_api_id": "gid://shopify/Product/6939083112511",
                    "variants": [
                        {
                            "id": 39672784060479,
                            "product_id": 6939083112511,
                            "title": "Default Title",
                            "price": "0.00",
                            "sku": "",
                            "position": 1,
                            "inventory_policy": "deny",
                            "compare_at_price": null,
                            "fulfillment_service": "manual",
                            "inventory_management": null,
                            "option1": "Default Title",
                            "option2": null,
                            "option3": null,
                            "created_at": "2022-05-10T10:51:22+09:00",
                            "updated_at": "2022-05-10T10:51:22+09:00",
                            "taxable": true,
                            "barcode": null,
                            "grams": 0,
                            "image_id": null,
                            "weight": 0.0,
                            "weight_unit": "kg",
                            "inventory_item_id": 41768407892031,
                            "inventory_quantity": 0,
                            "old_inventory_quantity": 0,
                            "requires_shipping": true,
                            "admin_graphql_api_id": "gid://shopify/ProductVariant/39672784060479"
                        }
                    ],
                    "options": [
                        {
                            "id": 9000180088895,
                            "product_id": 6939083112511,
                            "name": "Title",
                            "position": 1,
                            "values": [
                                "Default Title"
                            ]
                        }
                    ],
                    "images": [],
                    "image": null
                }
            }

            response_create a new draft product

            Step 3: Verify the new draft product

            After creating the draft product, we can check the draft product in Shopify Admin.

               

                • From Shopify Admin, choose products.

                • Search the draft product that you just created.

                • Click on the draft product.

              after creating a new draft product

              As you can see, the new draft product has been created successfully.

              The above are all steps to create a new draft product using Postman with Shopify API. If you have any questions, let us know in the comment below or refer to our Shopify API documentation.

              These steps will be shown visually in the video below.

              https://youtu.be/BuKnjR-TOQQ
              Shopify API – How to create a new draft product

              Hopefully, you can do it!