Skip to content

Instantly share code, notes, and snippets.

@Mikodes
Created March 21, 2019 12:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mikodes/b7fdbccfcf716ff750c15da954b77517 to your computer and use it in GitHub Desktop.
Save Mikodes/b7fdbccfcf716ff750c15da954b77517 to your computer and use it in GitHub Desktop.
var WPAPI = require('wpapi');
var wp = new WPAPI({
endpoint: 'https://premiumhouses.com/wp-json',
username: 'mike',
password: 'nokia123',
// auth: true
});
// wp.property = wp.registerRoute('wp/v2', '/estate_property');
wp.users().me().then(function (me) {
console.log(me)
}, function (error) {
console.log(error);
});
// wp.posts().create({
// // "title" and "content" are the only required properties
// title: 'Your Post Title',
// content: 'Your post content',
// // Post will be created as a draft by default if a specific "status"
// // is not specified
// status: 'publish'
// }).then(function (response) {
// // "response" will hold all properties of your newly-created post,
// // including the unique `id` the post was assigned on creation
// console.log(response.id);
// }, function (error) {
// console.log(error);
// })
// wp.property().create({
// title: 'Your Post Title',
// content: 'Your post content',
// status: 'publish',
// wpml_language: 'es',
// }).then(function (response) {
// // "response" will hold all properties of your newly-created post,
// // including the unique `id` the post was assigned on creation
// console.log(response.id);
// }, function (error) {
// console.log(error);
// });
// // wp.property().then(function (_properties) {
// // console.log(_properties)
// })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment