Support » Plugin: WP Live Chat Support » REST API Call URLs are bad

  • Resolved DeadTOm

    (@deadtom)


    Or perhaps I’m just using it wrong. I’m just starting to play around with REST.

    For example, I try to test this API call:

    /wp-json/wp_live_chat_support/v1/accept_chat

    I click the “Try” link, and go down to the Rest Console and this (sanitized) URL is already generated.

    https://<mydomain.com>/wp-json/wp_live_chat_support/v1/accept_chat?token=<some generated token>&chat_id=1&agent_id=0

    I click the “Try it!” button and nothing happens at all. Nothing appears in the console.

    If I paste that URL into my browser address bar, I get a Not Found page –

    Not Found
    
    The requested URL /wp-json/wp_live_chat_support/v1/accept_chat was not found on this server.

    Going to my WordPress install directory, there is indeed no /wp-json/ subdirectory, but maybe there is some kind of rewrite going on that makes it so that subdirectory doesn’t need to be there.

    In any case, the REST API does not appear to be working. Is there something I need to configure to make this work?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Contributor DylanAuty

    (@dylanauty)

    Hi @deadtom,

    Thank you for your time, we do appreciate it.

    Could I ask you to confirm if the values below are being replaced with the appropriate values of your website and the secret token generated in the settings area:
    – <mydomain.com>
    – <some generated token>

    If so, the issue may purely be that the REST API has been disabled on the website, or that your REST API is not on the default rewrite.

    If possible, please share a link to your website with me, and I would gladly run a few tests to confirm?

    Thank you for getting back to me.

    Yes, I changed those values when I posted them here.

    This is on a staging server inside our organization, on a fresh WordPress install on an Apache server. It is not accessible from the outside world.

    There is absolutely nothing in the .htaccess folder where WordPress is installed, so I’m guessing that some rewrite rules need to be added. I have no idea what those rules would look like.

    When running the “Site Health” tool in WordPress, it says that the REST API is available.

    I’ve enabled pretty permalinks, and that hasn’t resolved it. This appears to be an overall issue with WordPress and REST. So I’ll troubleshoot there first.

    Plugin Contributor DylanAuty

    (@dylanauty)

    Hi @deadtom,

    Thank you for your feedback we do appreciate it.

    This could be tested locally by simply navigating to http://mysite.com/wp-json

    It is possible that the REST API is not in the default location, however, WP Live Chat Support should overcome this issue when in use. With that said, it is possible the test URL’s would not adapt to a redirect/rewrite for example.

    I look forward to hearing back from you.

    http://mysite.com/wp-json Gives me a 404, page not found error.

    I’ve installed the Rest API log plugin, and that log shows it testing with https://mysite/index.php?rest_route=/wp/v2/types/post

    If I copy and paste that into the address bar, I do get some data back.

    • This reply was modified 2 months, 2 weeks ago by  DeadTOm.
    Plugin Contributor DylanAuty

    (@dylanauty)

    Hi @deadtom,

    Thank you for your time on this one.

    Yes, I believe this is then due to the test area not respecting the permalink setup of the website.

    We will need to release a patch to resolve this in the future. For the time being, if you intend on using custom REST requests, you can make use of the URL you have identified.

    Are you having any trouble with message storage or chat interactions?

    Okay, I’ll tinker with the URLs then.

    We haven’t gotten that far with it yet. I’ll let you know if we have any trouble there.

    Thank you for your time.

    Plugin Contributor DylanAuty

    (@dylanauty)

    Hi @deadtom,

    Thank you very much for your time and understanding on this one.

    Have a nice day further.

Viewing 9 replies - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.