The WordPress/WooCommerce API is broken on my site: http://example.com/wp-json/wp/v2/posts and http://example.com/wp-json/wc/v2/products both return a blank response.
Running a Python request by
response = requests.get('http://<mysite>.com/wp-json/wp/v2/posts', auth=HTTPBasicAuth(*auth))
gives a response (examined in a debugger) of
{
...
_content: b''
headers: ... 'content-type': 'text/html' ...
}
According to https://github.com/WP-API/WP-API/issues/2911, the blank response means there is an fatal php error.
Last week I was using the WordPress API to add WC products to my site, with no problems. I believe it stopped working when I installed the WordPress-rest-api plugin, then uninstalled it, after realizing it was not necessary.
I set up a development site as a sanity check and everything worked fine.
Specifically, I want the WooCommerce API to work, but I assume that means the rest API should also work.
We have backups, but there have been some changes since the last backup. Do I have to recreate the site from backup for it to work again?
EDIT:
The only error in error_log
is
[PHP Deprecated: Automatically populating $HTTP_RAW_POST_DATA is
deprecated and will be removed in a future version.
To avoid this warning set 'always_populate_raw_post_data' to '-1'
in php.ini and use the php://input stream instead.
in Unknown on line 0
which does NOT occur at the same times as my API requests.