Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

238
Views
send post request using wordpress api in node js

I'm trying to send a post request using wpapi library.

Refer to this question I created an application password but still doesn't work. can anybody help me here?

my code:

const WPAPI = require("wpapi");

 try {
  var ourPostData = {
    title: "dummy title",
    content: "dummy content",
    status: "draft",
  };


    var wp = new WPAPI({
      endpoint: "http://example.com/wp-json",
      username: "my username",
      password: "xxxx xxxx xxxx xxxx xxxx xxxx",
    });

   await wp.posts()
      .create(JSON.stringify(ourPostData))
      .then(function (response) {
        console.log(response.id); // This is undefined
      
      });

  } catch (err) {
    console.log("err", err); // No error
  }
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!