Product update API call working, but Product create API call fails.

jfkScollar
Shopify Partner
16 0 2

Hello,

I have an Excel VBA macro that updates products using the PUT https://{myshopname}/myshopify.com/admin/api/2021-07/products/{productid}.json call and it works fine. When I try and create a product using POST https://{myshopname}/myshopify.com/admin/api/2021-07/products.json it fails. It returns HTML code in the response body. The same product JSON package can create a product making the same call in Postman.

Any suggestions on why it may not work in Excel VBA yet PUT works in Excel VBA?

Thanks,

John

 

Replies 3 (3)

jfkScollar
Shopify Partner
16 0 2

I found a message that was a similar issue, and it appears cookies prevent the POST from working in VBA.

The solution (with VBA code) is found in the message below.

https://community.shopify.com/c/Shopify-APIs-and-SDKs/X-Shopify-Access-Token-Not-working-with-Privat...

Thanks,

John

pete96
New Member
11 0 0

Hi John,

 

I am ok with Excel and VBA but have no idea how I can use these tools to connect with my Shopify data and make updates to it. As an expert in this field, can you point me to a handy tutorial on this topic that would at least get me started? 

 

Many thanks in advance,

 

pete

jfkScollar
Shopify Partner
16 0 2

Hi Pete,

 

Here is a decent video to get you started with calling REST APIs from Excel using VBA and parsing its JSON response (https://www.youtube.com/watch?v=pHWopg_XxMc). You will also need to learn a tool like Postman to test calls to Shopify's API and see the resulting JSON response. That will help you code the parsing of the JSON.

 

The Excel workbook mentioned above, we have found saves us significant time to update our products. It has saved much more time then the time we put in building it. We are considering selling the spreadsheet for other Shopify Merchants to use.

 

John