• Resolved fcarriedos

    (@fcarriedos)


    Hello there,

    I am trying to get WooCommerce API up and running and I have already checked all the most common pitfalls (permalinks, permissions…) only to keep getting a 404 when trying to access the API:

    $ curl -u ck_0ee40164d3bdd847f2bf2abcf62f8ccc6cae5e10:cs_c2779c022fbc95df4923ccc8f1c544d4b6066f42 http://woocommerce/wp-json/wc/v1/orders
    
    <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
    <html><head>
    <title>404 Not Found</title>
    </head><body>
    <h1>Not Found</h1>
    <p>The requested URL /wp-json/wc/v1/orders was not found on this server.</p>
    <hr>
    <address>Apache/2.4.18 (Ubuntu) Server at woocommerce Port 80</address>
    </body></html>

    So I will try once again from scratch, posting the context after each step to this thread to try to spot the cause, perhaps with help from some more experienced users… 🙂

    The initial context of the installation is:

    • Ubuntu Server 16.04
    • PHP 7.0.28-0ubuntu0.16.04.1
    • Apache 2.2
    • MySQL 5.7
    • WordPress 4.9.6
    • WooCommerce 3.4.0
Viewing 4 replies - 1 through 4 (of 4 total)
  • dougaitken

    (@dougaitken)

    Automattic Happiness Engineer

    Hey @fcarriedos

    Can we back up for a minute? What is your overall goal here?

    Second, can you edit your comment and delete those API keys, please (unless this is a localhost install)

    The requested URL /wp-json/wc/v1/orders was not found on this server.

    Silly question… do you have any orders on your site?

    Thanks,

    Thread Starter fcarriedos

    (@fcarriedos)

    Hello @dougaitken

    My overall goal is to enable my local installation to get access to the WooCommerce API (v1, v2) for some development I want to do.

    As said, it is a localhost, so no problem in seeing the keys.

    I don’t have orders, but I created a product, tried to access the product endpoint and got the same result.

    Any hint?

    Thanks a lot for your support!

    F

    Plugin Support Ryan Ray

    (@ryanr14)

    Hi there,

    I noticed your URL wasn’t complete, so maybe that is just the issue here returning the 404. You had the following…

    $ curl -u ck_0ee40164d3bdd847f2bf2abcf62f8ccc6cae5e10:cs_c2779c022fbc95df4923ccc8f1c544d4b6066f42 http://woocommerce/wp-json/wc/v1/orders
    

    Your URL seems it’s missing a TLD. –> “http://woocommerce/&#8221;

    I would also use V2 if you can and use a curl command like this, but change/fill in the details for your site. Also, it may need this curl auth for a local site over HTTP and not HTTPS.

    curl https://www.example.com/wp-json/wc/v2/orders \
        -u consumer_key:consumer_secret

    Using an app called Insomnia I was able to make it work with a hosted site over HTTPS and a local site with HTTP.

    HTTPS

    HTTP

    • This reply was modified 8 years, 1 month ago by Ryan Ray.
    • This reply was modified 8 years, 1 month ago by Ryan Ray.
    jessepearson

    (@jessepearson)

    Automattic Happiness Engineer

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Get WooCommerce API up and running’ is closed to new replies.