Lieber Christian,
du bist mein letzter Rettungsanker. Verzweifelt versuche ich die Wordpress/Woocommerce Rest Api mit MBS zum Laufen zu bringen. Leider komme ich mit den zu übergebenden Daten nicht weiter. Es gelingt mir lediglich, über die URL entsprechende Werte abzusetzen: https://www.lucky-liquids.de/wp-json/wc/v2/products?name=works+am+morks®ular_price=99.99&description=Eine+sehr+vielsagende+Produkt-Beschreibung"&consumer_key=ck_0cbf748c546facfe28420a019640b148ad14bb26&consumer_secret=cs_9843c63a57363f1677efefb1f55525683eec47b8 Über den Befehl SetOptionsPostFields werden keine Daten weiter gegeben. Ich erhalte dann die Fehlermeldung: {"code":"woocommerce_rest_authentication_error","message":"Consumer secret is invalid.","data":{"status":401}} Ich könnte das Alles auch übe die URL abwickeln, habe hier aber das Problem, dass ich die Syntax der Array-Bildung leider nicht drauf habe. Ich habe mit [] gearbeitet und die als URL-Encoed eingesetzt, ohne Erfolg. Das ist der Link der Woocommerce API-Beschreibung: https://woocommerce.github.io/woocommerce-rest-api-docs/?shell#create-a-product Example of how to create a simple product: curl -X POST https://example.com/wp-json/wc/v2/products \ -u consumer_key:consumer_secret \ -H "Content-Type: application/json" \ -d '{ "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", "position": 0 }, { "src": "http://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2013/06/T_2_back.jpg", "position": 1 } ] }' Meine Kategorien haben die ID: 130 mit dem Namen "Komplett Sets" bzw. für eine Variation: https://woocommerce.github.io/woocommerce-rest-api-docs/?shell#create-a-product-variation Als Grundlage habe ich Deine Beispieldatei für die Anbindung von Salesforce verwendet: MBS("CURL.New") MBS("CURL.SetOptionHTTPHeader"; $curl; "Content-Type: Content-Type: application/json") $xml=Login::XML Template Query MBS( "CURL.SetOptionPost"; $curl; 1 ) MBS("CURL.SetOptionPostFields"; $curl; $xml) MBS("CURL.SetDebugWithData"; $curl; 1) MBS("CURL.SetOptionPostFields"; $curl; "regular_price=99.99"; "UTF-8") MBS( "CURL.SetOptionVerbose"; $curl; 1 ) MBS("CURL.Perform"; $curl) kannst Du mir vielleicht einen Tipp geben, wie ich weiter komme? Viele Grüße, Felix _______________________________________________ Mbsfmplugin_monkeybreadsoftware.info mailing list [email protected] https://ml01.ispgateway.de/mailman/listinfo/mbsfmplugin_monkeybreadsoftware.info
