• Hi,

    I defined a custom route with register_routes – works fine. Now I can access the REST API with:

    mydomain.com/wphhv/test

    The API returns JSON too. So far no problems.

    But when I add a parameter to my URL – like:

    mydomain.com/wphhv/test?val1=1234&val2=abcd

    The API returns an 404 error all the time (checked with http://jsonformatter.curiousconcept.com – just entering the URL into a browser shows no error, but the correct data. When I access the API from an iOS client, I run into the 404 error too).

    The wordpress permalink structure is set to “Post name”.

    Any idea what’s going wrong?

    Best regards,

    Detlef

    https://wordpress.org/plugins/json-rest-api/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter web_line

    (@web_line)

    P.S.: with
    curl -I http://mydomain.com/wphhv/test?val1=1234&val2=abcd
    I get
    HTTP/1.1 404 Not Found

    with
    curl -I http://mydomain.com/wphhv/test

    I get
    HTTP/1.1 200 OK

    Thread Starter web_line

    (@web_line)

    P.P.S.: here is my htaccess setup:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    Thread Starter web_line

    (@web_line)

    P.P.S.: it is not the GET parameter syntax in general because mydomain.com/wp-json/posts?type[]=project works fine.

    All facts:
    – the PlugIn is up and running
    – basic functions work
    – custom routes work
    – passing get parameters to a custom route return the HTTP status 404

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘404 when passing args to the API’ is closed to new replies.