These are chat archives for WP-API/node-wpapi

Dec 2018
Juan Alvarez
Dec 12 2018 12:28
@Praful you are missing .get()
It should be wp.posts().get()
K Adam White
Dec 12 2018 15:54
Hello! I think unfortunately it's a bit more complicated than that; when we launched this project, did not yet support the REST API so all of our documentation is oriented towards self-hosted sites
If your blog is available through at, you can't access the API at as you normally would
instead, @Praful try making requests against
That would be your endpoint, so a .posts() request would yield
There's things that probably won't work because this library was written assuming the normal WordPress API structure, and the addition of the sites/ string following the namespace on .com api endpoints somewhat breaks that assumption. Unfortunately this will likely be a frustration for you.
@computamike I'd say perhaps it's less "alive" than "on life support;" I do intend to revisit the project this winter, but in the meantime I thank you for your PRs. I have seen them and will merge as soon as I'm able to devote an afternoon to catching up.
Mees Rutten
Dec 12 2018 20:40

Hey! I have a small question about an error i'm facing.

   code: 'rest_no_route',
   message: 'No route was found matching the URL and request method',
   data: { status: 404 } 

This happens when I do this in Node:

const WPAPI =     require( 'wpapi' ),
    ENV =         require( 'dotenv' ).config().parsed

const wp = new WPAPI( {
    endpoint: ENV.WP_API_ENDPOINT,
    username: ENV.WP_API_USERNAME,
    password: ENV.WP_API_PASSWORD,
    auth: true
} )

wp.pages().get().then( data => {
    // do something with the returned posts
    console.log( data )

} ).catch( err => {
    console.log( err )
} )
But the thing is, when I navigate to the endpoint i'm using https://website/index.php/wp-json/wp/v2/pages/6 I can see the JSON correctly