{"id":7316,"date":"2019-03-08T22:32:31","date_gmt":"2019-03-08T22:32:31","guid":{"rendered":"https:\/\/alt2.minisoft.com\/support\/?p=7316"},"modified":"2020-12-01T09:44:24","modified_gmt":"2020-12-01T17:44:24","slug":"integrating-eformz-with-woo-commerce-api","status":"publish","type":"post","link":"https:\/\/c002.minisoft.com\/support\/integrating-eformz-with-woo-commerce-api\/","title":{"rendered":"Integrating eFORMz with Woo Commerce API"},"content":{"rendered":"\n<p>To integrate eFORMz with Woo Commerce you will need to do\nweb service calls from eFORMz to the woo commerce rest API.<\/p>\n\n\n\n<p>To see how to do a web service call using eFORMz please look\nat this article:<\/p>\n\n\n\n<figure class=\"wp-block-embed-wordpress wp-block-embed is-type-wp-embed is-provider-miniwiki\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"90IWANHnjb\"><a href=\"https:\/\/minisoft.com\/support\/index.php\/web-service-post-call-output\/\">Web Service POST Call Output<\/a><\/blockquote><iframe class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;Web Service POST Call Output&#8221; &#8212; MiniWiki\" src=\"https:\/\/minisoft.com\/support\/index.php\/web-service-post-call-output\/embed\/#?secret=90IWANHnjb\" data-secret=\"90IWANHnjb\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>In order to be able to do this you will need the URL to access your data on Woo Commerce and a user with a consumer key and secret. In order to get this, work with your Woo Commerce contact.<\/p>\n\n\n\n<p>Once you have these pieces of information you are ready to connect to the Woo Commerce API.<br><br>The Woo Commerce API allows you to connect to pull or push all kinds of data. You can retrieve information on a single order, or retrieve ALL orders that are ready for processing.  You can also update the order status to Complete once the order has been processed in eFORMz.<br><br>To view the various types of info that can be retrieved, review the Woo Commerce API documentation:<\/p>\n\n\n\n<p><a href=\"http:\/\/woocommerce.github.io\/woocommerce-rest-api-docs\/#introduction\">http:\/\/woocommerce.github.io\/woocommerce-rest-api-docs\/#introduction<\/a><\/p>\n\n\n\n<p>Once you have chosen the type of data you wish you retrieve via the API, you will need to create four Variables in the eFORMz project:<br><br><strong>URL<\/strong> \u2013 used to store the URL for the instance and API call you are executing.<br><br><strong>WebResponseData<\/strong> \u2013 used to store the data that is returned from the API call<br><br><strong> WebResponseCode<\/strong> \u2013 used to store the API call code that is returned (200, 400, 500, etc.)<br><br> <strong>Authorization<\/strong> \u2013 used to store your <strong>Consumer Key <\/strong>and <strong>Secret.<\/strong><\/p>\n\n\n\n<p>In order to correctly call the API from eFORMz you will need to store the Consumer Key and Secret correctly as follows&#8230;..<\/p>\n\n\n\n<ol><li>Set the value of the Authorization variable to your Consumer Key<\/li><li>Concatenate <strong>\u201c:\u201d <\/strong><\/li><li>Concatenate your Consumer Secret. <\/li><li>Encode the variable to Base64.<\/li><li>Remove any instances of the string \u201c\\r\\n\u201d by doing a REPLACE.<\/li><li>Insert the value \u201cBasic\u201d at index 0. <\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"277\" height=\"115\" src=\"https:\/\/alt2.minisoft.com\/support\/wp-content\/uploads\/2019\/03\/Authorization.png\" alt=\"\" class=\"wp-image-7317\" srcset=\"https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2019\/03\/Authorization.png 277w, https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2019\/03\/Authorization-150x62.png 150w, https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2019\/03\/Authorization-250x104.png 250w\" sizes=\"(max-width: 277px) 100vw, 277px\" \/><\/figure>\n\n\n\n<p>In the web service procedure, you need to chose the proper request verb depending on what the API call requires.  <br><br>In this example we are doing a call to retrieve all open orders, so we use a GET instruction. <br><\/p>\n\n\n\n<p>Here are the steps to setting up your web service call.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<ol><li>Authorization = the value of the Authorization variable we just prepared<\/li><li>Accept = the value of \u201capplication\/json\u201d <\/li><li>User-Agent =  \u201ceFORMz\/11.02.11\u201d. <\/li><li>Once you have done this chose to use a variable for the URL&nbsp; and use the URL variable that you have stored with the correct URL.<\/li><li>Put the Output data as MIME <\/li><li>Set the Response data to your WebResponseData variable. <\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"423\" height=\"616\" src=\"https:\/\/alt2.minisoft.com\/support\/wp-content\/uploads\/2019\/03\/WebServiceCall-1.png\" alt=\"\" class=\"wp-image-7319\" srcset=\"https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2019\/03\/WebServiceCall-1.png 423w, https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2019\/03\/WebServiceCall-1-206x300.png 206w, https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2019\/03\/WebServiceCall-1-103x150.png 103w, https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2019\/03\/WebServiceCall-1-250x364.png 250w, https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2019\/03\/WebServiceCall-1-124x180.png 124w, https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2019\/03\/WebServiceCall-1-343x500.png 343w\" sizes=\"(max-width: 423px) 100vw, 423px\" \/><\/figure>\n\n\n\n<p>Once you have done this add the procedure to set the\nvariable WebResponseCode after the WebService procedure.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"265\" height=\"68\" src=\"https:\/\/alt2.minisoft.com\/support\/wp-content\/uploads\/2019\/03\/WebResponseCode.png\" alt=\"\" class=\"wp-image-7320\" srcset=\"https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2019\/03\/WebResponseCode.png 265w, https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2019\/03\/WebResponseCode-150x38.png 150w, https:\/\/c002.minisoft.com\/support\/wp-content\/uploads\/2019\/03\/WebResponseCode-250x64.png 250w\" sizes=\"(max-width: 265px) 100vw, 265px\" \/><\/figure>\n\n\n\n<p>The data returned from the API comes back in JSON. Please look at this article on how to handle JSON in eFORMz:<\/p>\n\n\n\n<figure class=\"wp-block-embed-wordpress wp-block-embed is-type-wp-embed is-provider-miniwiki\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"CavwHXMb2U\"><a href=\"https:\/\/minisoft.com\/support\/index.php\/processing-json-data-in-eformz-projects\/\">Processing JSON Data in eFORMz Projects<\/a><\/blockquote><iframe class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;Processing JSON Data in eFORMz Projects&#8221; &#8212; MiniWiki\" src=\"https:\/\/minisoft.com\/support\/index.php\/processing-json-data-in-eformz-projects\/embed\/#?secret=CavwHXMb2U\" data-secret=\"CavwHXMb2U\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>To integrate eFORMz with Woo Commerce you will need to do web service calls from eFORMz to the woo commerce rest API. To see how to do a web service call using eFORMz please look at this article: In order to be able to do this you will need the URL to access your data [&hellip;]<\/p>\n","protected":false},"author":15,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[106],"tags":[107,342,508],"_links":{"self":[{"href":"https:\/\/c002.minisoft.com\/support\/wp-json\/wp\/v2\/posts\/7316"}],"collection":[{"href":"https:\/\/c002.minisoft.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/c002.minisoft.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/c002.minisoft.com\/support\/wp-json\/wp\/v2\/users\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/c002.minisoft.com\/support\/wp-json\/wp\/v2\/comments?post=7316"}],"version-history":[{"count":4,"href":"https:\/\/c002.minisoft.com\/support\/wp-json\/wp\/v2\/posts\/7316\/revisions"}],"predecessor-version":[{"id":8687,"href":"https:\/\/c002.minisoft.com\/support\/wp-json\/wp\/v2\/posts\/7316\/revisions\/8687"}],"wp:attachment":[{"href":"https:\/\/c002.minisoft.com\/support\/wp-json\/wp\/v2\/media?parent=7316"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/c002.minisoft.com\/support\/wp-json\/wp\/v2\/categories?post=7316"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/c002.minisoft.com\/support\/wp-json\/wp\/v2\/tags?post=7316"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}