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

Dec 2018
Dec 04 2018 17:06

Hello, I've just created a free site at I created a js script to read posts using the node-wpapi and ran the script using node script.js. It has no UI component. This is the code I'm using, copied from the Github docs for the node-wpapi:

var WPAPI = require('wpapi');
var wp = new WPAPI({
  endpoint: '',
  username: 'myusername',
  password: 'mypassword'

function readPosts() {
  // Promises
  wp.posts().then(function (data) {
    // do something with the returned posts
  }).catch(function (err) {


However, I get an error with output that starts with:

{ Error: Not Found
    at Request.callback (C:\data\dev\projects\facebook-to-wordpress\node_modules\superagent\lib\node\index.js:706:15)
    at Stream.parser (C:\data\dev\projects\facebook-to-wordpress\node_modules\superagent\lib\node\index.js:916:18)
    at Stream.emit (events.js:182:13)
    at Unzip.unzip.on (C:\data\dev\projects\facebook-to-wordpress\node_modules\superagent\lib\node\unzip.js:55:12)
    at Unzip.emit (events.js:187:15)
    at endReadableNT (_stream_readable.js:1085:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
  status: 404,
   Response {

I used the console app, (using options WP REST API, wp/v2) and that does return posts.

Please can someone help me understand what I'm doing wrong.

Ultimately, I want to write a script that reads my Facebook downloaded data (json format) and creates posts on Wordpress. I couldn't find anything that does this.