Hi,

And for everyone using WOO REST API with WooCommerce:

Set Variable [ $curl ; Value: MBS("CURL.New") ] 

// Put in your entry point:

Set Variable [ $r ; Value: MBS("CURL.SetOptionURL"; $curl; 
"https://example.com/wp-json/wc/v2/products"; ) ] 

// We send JSON, so use that for content type:

Set Variable [ $r ; Value: MBS("CURL.SetOptionHTTPHeader"; $curl; 
"Content-Type: Content-Type: application/json") ] 

// For creating entries, we need POST data, so pass the JSON here:

Set Variable [ $xml ; Value: Login::XML Template Query ] 
If [ Length ( $xml ) > 0 ] 
        Set Variable [ $r ; Value: MBS( "CURL.SetOptionPost"; $curl; 1 ) ] 
        Set Variable [ $r ; Value: MBS("CURL.SetOptionPostFields"; $curl; $xml) 
] 
End If

// set your keys for username and password:
Set Variable [ $r ; Value: MBS("CURL.SetOptionUsername"; $curl; 
"ck_0cbf748c546....") ] 
Set Variable [ $r ; Value: MBS("CURL.SetOptionPassword"; $curl; 
"cs_9843c63a573....") ] 

// run it
Set Variable [ $result ; Value: MBS("CURL.Perform"; $curl) ] 
// and check result:
Set Field [ Login::CURL Result ; $result ] 
Set Variable [ $httpResponseCode ; Value: MBS( "CURL.GetResponseCode"; $curl ) 
] 
Set Field [ Login::CURL Result ; $r ] 
Set Field [ Login::CURL Output ; MBS("CURL.GetResultAsText"; $curl; "UTF8") ] 
Set Field [ Login::CURL Debug ; MBS("CURL.GetDebugAsText"; $curl; "UTF8") ] 
If [ $r = "OK" and $httpResponseCode >= 200 and $httpResponseCode < 300 ] 
        # Process XML from results here
End If
Set Variable [ $r ; Value: MBS("CURL.Cleanup"; $curl) ] 

Sincerely
Christian

-- 
Read our blog about news on our plugins:

http://www.mbsplugins.de/


_______________________________________________
Mbsfmplugin_monkeybreadsoftware.info mailing list
[email protected]
https://ml01.ispgateway.de/mailman/listinfo/mbsfmplugin_monkeybreadsoftware.info

Reply via email to