WooCommerce API Healthiness

The Autoship Cloud plugin integrates your WooCommerce site with QPilot using the WooCommerce REST API (version 2).

While the Autoship Cloud plugin does not add to, change or modify your site's REST API, it is very important that your site's WooCommerce REST API is enabled and fully functional to ensure a successful connection with QPilot.

If you are experiencing issues connecting Autoship Cloud to QPilot, it's a good idea to test the WooCommerce API to ensure it is accessible and healthy.

Note: The REST API is a feature of WooCommerce and you may test your site's REST API with or without the Autoship Cloud powered by QPilot plugin being active on your site at any time by following WooCommerce's documentation here.

Testing the WooCommerce API

  1. Navigate to WooCommerce > Settings >> Advanced >> REST API
  2. In older versions of WooCommerce, you may need to select "Enable the REST API" and Save Changes before proceeding.

  3. In the REST API tab, add a new API Key with the settings below:

    Description: "Test Key" (or any description you choose)
    User: Select a user who has Administrator User privileges for the Wordpress site
    Permissions: Read/Write
  4. Follow the guide for  Making a Basic Request to test the WooCommerce API with your site.

How QPilot Makes API Requests

GET Request

Used to securely pass Data from WooCommerce to QPilot to keep data synchronized, including:

  • Order Data
  • Product Data
  • Customer Data
  • Tokenized Payment Data

POST Request

Used to securely create WooCommerce Orders when processing a Scheduled Order over WooCommerce REST API

PUT Request

Used to securely update WooCommerce Order data when processing a Scheduled Order over the REST API.
Also used to securely update product availability data for WooCommerce Products and add QPilot data to Reports and Notifications in Wordpress.

Common Error Responses

401 Unauthorized / 403 Forbidden

  1. Check that the WooCommerce API is enabled on the site. This setting is found in the WP Admin under WooCommerce > Settings > API > Enable the REST API.
  2. Check that there is a valid WooCommerce API key for "Autoship - QPilot". The API keys are listed under WooCommerce > Settings > API > Keys/Apps.
    1. If there is no API key for "Autoship - QPilot", follow the guide to Connect Autoship Cloud.
    2. Ensure that the associated user account for this API key is a site administrator with full privileges to manage WooCommerce.
  3. Remove any .htaccess rules which are restricting access to the site. This will be problematic for incoming requests.
  4. Disable any plugins that are blocking access to the site.

400 Bad Request

The 400 error code indicates that the request is invalid, e.g. using an unsupported HTTP method.  

The error is most common with staging sites using an insecure URL ("http" instead of "https"). This is error is documented by WooCommerce's REST API docs here: https://woocommerce.github.io/woocommerce-rest-api-docs/#errors

If this is the case, you may want to ask your hosting provider to enable your staging site to be a secure URL (use " https://mysite.staging.myhost.com" instead of "http"), so you can then connect your site's API without using the secure URL.

500 Internal Server Error

The 500 error indicates a fatal exception has been thrown on the server. This type of error can be caused by many different types of issues, and the source of the error must be tracked down.

  1. Check the server error log for any obvious errors. Contact your site administrator to correct these errors then try again.
  2. De-activate all plugins on the site except for WooCommerce. Test the API and activate additional plugins one at a time until the source of the error is found.
  3. Change the current theme to the default Wordpress theme (WP 2017) then test the API. The default Wordpress theme should not produce any errors. 

PHP Warnings and Errors

Sometimes the WooCommerce API can produce PHP error messages in the response instead of properly formatted JSON.

  1. De-activate all plugins on the site except for WooCommerce. Test the API and activate additional plugins one at a time until the source of the error is found.
  2. Change the current theme to the default Wordpress theme (WP 2017) then test the API. The default Wordpress theme should not produce any errors. 

Still need help? Contact Us Contact Us