• I have a JSON data which I want to get from my wordpress headless CMS site here.

    const wpUrl = "https://jameslaiproductions.ml/wp-json/wp/v2/posts";

    However, I received a network error when getting data from this url.

    On the other hand, I am successful in getting data from any of the two url below:

    const wpUrl = "https://test.frontity.org/wp-json/wp/v2/posts";
    const wpUrl = "https://oncoinfo.it/wp-json/wp/v2/posts";

    I suspect that the issue is with my WordPress or shared server hosting settings. But I can’t seem to identify the problem & solution to this problem. Please refer to the sandbox link below to view the replicated problem. Any idea how to solve this problem?

    https://codesandbox.io/s/epic-sanderson-zpm8n?file=/src/component/Test01.js

    • This topic was modified 3 years, 8 months ago by laijames92. Reason: added wp-json rest api site url
Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello!

    I was able to grab the posts endpoint of your site via my browser, but received a 403 when trying to curl it or grab it through PHP or Python. Additionally, when inputting another test site’s /posts endpoint, the sandbox works without error.

    This seems like it may be an error in the way the web server is responding. I’d suggest reaching out to your web host in this case to see if they can provide any further insight into what kind of response codes those network errors are getting.

    Thread Starter laijames92

    (@laijames92)

    Thanks. I’ve reached out to my webhost (Infinity Free) and they responded that this cannot work due to its security system. More info here.

    Now moving on to my next question;

    1. Is there any way to work around this? If yes, how?
    2. Which free web hosting service provider do you guys use to retrieve data from WP-Json?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Cannot get WP Json from WordPress’ is closed to new replies.