Can't connect to my WordPress hosted blog with the REST API – 404 not found error

  • Unknown's avatar

    So, I am trying to use Node to connect to my WordPress site to get my posts, like this:

    var WP = require( ‘wordpress-rest-api’ );
    var wp = new WP({
    endpoint: ‘https://dellingsen.wordpress.com/wp-json/wp/v2/posts’,
    username: ‘dellingsen’,
    password: ‘xxxxxxxx’
    });

    wp.posts().get(function( err, data ) {
    if ( err ) {
    console.log(‘Error!’);
    console.log(err);
    }
    console.log(‘GET Posts: ‘);
    console.log(data);
    });

    This is the error I am getting:
    { Error: cannot GET /wp-json/wp/v2/posts/wp/v2/posts (404)

    What am I missing? Some things I read talked about Permalinks, but I don’t even see Permalinks anywhere on my WordPress site in the Settings.

    The blog I need help with is: (visible only to logged in users)

  • Hi there,

    For help with using the API, please use the contact form on our developers page:

    Contact

    This forum is more for help in using WordPress.com itself. Neither forum staff nor the volunteers have the expertise to help you with API issues :)

  • The topic ‘Can't connect to my WordPress hosted blog with the REST API – 404 not found error’ is closed to new replies.