WooCommerce API Healthiness

The WooCommerce API must be enabled and fully functional for a successful connection with Autoship Cloud and QPilot.

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

Testing the WooCommerce API

  1. Navigate to WooCommerce > Settings > API.
  2. Select to Enable the REST API and Save Changes.

  3. Click the Keys/Apps tab. Add a new API Key with the settings below: 
    Description: Test Key
    User: Select a user who has Admin privileges on the site. Ensure that the selected user has Admin privileges.
    Permissions: Read/Write
  4. Follow the guide for  Making a Basic Request to test the WooCommerce API with your site.

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 an invalid value has been submitted to the WooCommerce API. Ensure that the IDs and attributes of the request match the data on the current site. The entities below must be an exact match to the corresponding WooCommerce data on the site:

  • Customers
  • Products
  • Orders

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