Hi
Thanks for coming back to me regarding my issue.
To answer your question, yes - I looked at this doc and that’s how I came up with the Curl commands.
I am using slightly different information from that used in the example - after all, my website doesn’t sell iPods! ? But other than catching products based on their tag rather than their title, and using the only relation allowed for tag which is equals, my code is pretty much identical to the example.
I am still running into errors - here is my output when I run the command:
C:\Users\{UserName}>curl -d '{"smart_collection":{"title":"Accounting","rules":[{"column":"tag","relation":"equals","condition":"Accounting"}]}}' -X POST "https://{API key}:{API Password}@{my-website}.myshopify.com/admin/api/2021-10/smart_collections.json" -H "X-Shopify-Access-Token: {API Password}"
{"errors":{"smart_collection":"Required parameter missing or invalid"}}
C:\Users\{UserName}>
As for testing a GET or PUT request, I have set up Pipedream and sent a simple POST request which returns my shop id and name, and I have re-jigged my request into node.js:
import Shopify, { DataType } from '@shopify/shopify-api';
const client = new Shopify.Clients.Rest('{my-website}.myshopify.com', accessToken);
const data = await client.post({
path: 'smart_collections',
data: {"smart_collection":{
"title":"Anthropology",
"rules":[
{
"column":"tag",
"relation":"equals",
"condition":"Anthropology"
}
]
}
},
type: DataType.JSON,
});
But then I get this result:
TypeErrorCannot read property 'Rest' of undefined
at Object.default (file:///opt/ee/c_9OfWxj7/index.mjs:4:36)
at MessagePort.messageHandler (/opt/nodejs/node_modules/@pipedreamhq/execution-environment/launch_worker.js:594:41)
No return values or exportsfor this step
The error from my Curl command says a required parameter is missing or invalid, but I can’t find anything in the documentation on what I am missing. ?
Thanks again,
Paul Cutcliffe