Creating more than one product with API in Shopify, possible?

TonyJ
Excursionist
16 1 0

Hello Community

We’d like to create more than one product at the same time using the product API.
The Below POST to the API intends to create two products and would result into an error:

{"errors": {"product": "expected Array to be a Hash"}}

Would someone please kindly advice on the below requests?

{

  "product": [

  {

    "title": "Burton Custom Freestyle xxx",

    "body_html": "<strong>Good snowboard!</strong>",

    "vendor": "Burton",

    "product_type": "Snowboard",

    "metafields": [

      {

        "key": "new",

        "value": "newvalue",

        "value_type": "string",

        "namespace": "global"

      }

    ]

  },

 

   {

    "title": "Burton Custom Freestyle yyy",

    "body_html": "<strong>Good snowboard!</strong>",

    "vendor": "Burton",

    "product_type": "Snowboard",

    "metafields": [

      {

        "key": "new",

        "value": "newvalue",

        "value_type": "string",

        "namespace": "global"

      }

    ]

  }

  ]

}

0 Likes