Thanks for reaching out @taisa1984, and appreciate you sharing the troubleshooting checks already performed. So we can determine more on this, please share the following:
- Your Site Health information. You can use this form to share privately if preferred.
- Do you see any warnings or errors when checking your Site Health status (Tools > Site Health > Status), which differs from your Site Health information requested above? Such errors may include REST endpoint references.
I checked that I can access the API with mydomain.com/wp-json and some code appears.
What you’re encountering may be specific to some non standard REST endpoints. Once we have the above we can determine more on this.
Let me know if you have any questions with the above.
Ok, this was really odd.
I went to the Site health check and had an error about the REST API. I checked the link they gave and got a blank page with only this message:
{“code”:”rest_forbidden_context”,”message”:”Du bist leider nicht berechtigt, Beitr\u00e4ge dieses Inhaltstyps zu bearbeiten.”,”data”:{“status”:401}}
As it was all in German, I went and changed my user language so I could bring here the details in english.
Now I have no Error on the Site health, and appears like the REST API is working.
But sill can’t connect. I cleared the cache too and nothing.
Changed again the user language, the API seems to be fine. But still can’t connect.
Tried to change firewall mode to learning again, as it wasn’t and nothing.
Can it be language or charset related? It makes little sense, but I don’t know…
I am sending the Site health info by the form.
Best regards and thanks,
Taisa
Thanks for the update @taisa1984. I checked your site and I am able to access your public REST endpoints successfully. Based on this, please follow the steps below, which can help rule out browser or third party plugin related issues resulting in the REST API error you’re encountering:
- Login to your live site from a Chrome browser incognito window.
- Install and activate the Health Check & Troubleshooting plugin.
- Navigate to “Plugins > Health Check & Troubleshooting > Troubleshoot”.
- From the same screen click on the “Available Plugins” tab at the top right and then click on the “Enable” option next to “Site Kit by Google“.
- Attempt to setup Site Kit once more.
If you run into any issues, or if you have any questions with the above, let me know. Note also that in relation to your query about this bring possibly language or charset related, it doesn’t look to be related. If you encounter the same “Site Kit cannot access the WordPress REST API” error let me know.
Hi,
Thanks for your time.
Just tried, incognito mode, installed the plugin and troubleshooting mode for Site kit.
And still have the same REST API error showing and can’t connect.
Anything else I could try?
Regards,
Taisa
Hi Taisa,
If the same is occurring while using the Health Check & Troubleshooting mode, it’s possible something at host level or with your WordPress configuration is impacting your WordPress REST API. There are a couple of things you can try. Firstly, can you visit your permalink settings (Settings > Permalinks) and press the “Save changes” button? This can refresh your .htaccess file, ensuring anything within that file is updated. I noticed a htaccess_extra_rules: true flag in your Site Health information. After doing so please attempt Site Kit setup once more.
Another option is to attempt Site Kit setup from another WordPress site on the same hosting platform.
Let me know how you get on after performing the above, or ask if you have any questions.
I tried with permalinks but nothing. I think I already had tried cleaning the .htacces file. But I tried that again too and had the same message.
I tried from another site on the same hosting and had the same problem too.
I will contact the company and ask before doing anything else.
Thanks,
Taisa
Well, hosting support told me they don’t support REST API and that they have their own API. But I guess it is not possible to connect using another one.
I think we can’t do anything about this.
Thanks and regards,
Taisa
Sorry to hear that @taisa1984. The standard WordPress editor and other plugins make us of the WordPress REST API, so it’s possible that you’re hosting provider may apply changes going forward. Hopefully at that stage you will be able to use Site Kit.
Best of luck regardless, and do let us know if you have any further queries.