Hi!
I'm stuck in a process of accessing / making requests a testing woocommerce instance.
This allowed me to crash on a old problem I've had in node-red: how to pass cURL parameters in a call.
How do I - say - create a product?
While I'm able to authenticate and retrive the list of products, I don't understand how to pass parameters in the call, to be specific, the -d
specified in the call with the json.
my flow:
[{"id":"153f50acda5fe0d6","type":"http request","z":"8dbd31e890d4295d","name":"","method":"GET","ret":"obj","paytoqs":"ignore","url":"{{{site}}}{{{endPoint}}}","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"basic","senderr":false,"headers":[],"x":447.17896270751953,"y":905.0554389953613,"wires":[["b044df9340de714e"]]},{"id":"b044df9340de714e","type":"debug","z":"8dbd31e890d4295d","name":"","active":true,"console":"false","complete":"payload","x":578.0992164611816,"y":848.545488357544,"wires":[]},{"id":"ffb38a52daba1dd0","type":"change","z":"8dbd31e890d4295d","name":"Set Headers","rules":[{"t":"set","p":"headers","pt":"msg","to":"{}","tot":"json"},{"t":"set","p":"headers.content-type","pt":"msg","to":"application/json","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":312.0994644165039,"y":850.3637266159058,"wires":[["153f50acda5fe0d6"]]},{"id":"1730582a0669739a","type":"inject","z":"8dbd31e890d4295d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"},{"p":"endPoint","v":"/wp-json/wc/v3/products","vt":"str"},{"p":"site","v":"mySite.com","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"name\":\"Premium Quality\",\"type\":\"simple\",\"regular_price\":\"21.99\",\"description\":\"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.\",\"short_description\":\"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.\",\"categories\":[{\"id\":9},{\"id\":14}],\"images\":[{\"src\":\"http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_2_front.jpg\"},{\"src\":\"http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_2_back.jpg\"}]}","payloadType":"json","x":193.09944915771484,"y":910.3636865615845,"wires":[["ffb38a52daba1dd0"]]},{"id":"d018848cf10db5ef","type":"comment","z":"8dbd31e890d4295d","name":"Create a Product in Woocommerce","info":"","x":369.19036865234375,"y":786.4247627258301,"wires":[]}]