Created
March 21, 2019 12:26
-
-
Save Mikodes/b7fdbccfcf716ff750c15da954b77517 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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