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

13th
Dec 2018
K Adam White
@kadamwhite
Dec 13 2018 04:44
@meesrutten What is the value of ENV.WP_API_ENDPOINT?
When I navigate there it shows me the JSON, so the link isn't broken
K Adam White
@kadamwhite
Dec 13 2018 13:19
@meesrutten the endpoint should only be the piece ending in wp-json; if you console.log(
console.log( wp.pages().toString() )`
Mees Rutten
@meesrutten
Dec 13 2018 13:21
I'll try!
K Adam White
@kadamwhite
Dec 13 2018 13:21
I suspect you may see that you’re getting a URL like https://website/index.php/wp-json/wp/v2/pages/6/wp/v2/pages. You should set the endpoint to only https://website/index.php/wp-json
Forgive the poor formatting, trying to use gitter via mobile web ;)
Mees Rutten
@meesrutten
Dec 13 2018 13:33
ah it seems to work
Do you know how I can get a certain page by ID?
wp.pages().id(6).then(...) seems to do the trick
Mees Rutten
@meesrutten
Dec 13 2018 13:40
@kadamwhite it works now! Thank you so much :)
BTW, love the node-wpapi! My clients still get WordPress and I don't get the headache of WordPress :)
Praful
@Praful
Dec 13 2018 17:23
@jlalvarez18 thanks for replying.
@kadamwhite I've switched to developing in a local Docker WordPress install now! However, for others, I used endpoint https://praful.home.blog/?rest_route=/' since my test site on WordPress.com is praful.home.blog. I also used http://prafulhome.wordpress.com/wp-json.
Praful
@Praful
Dec 13 2018 17:28

@kadamwhite On another note, I want to add an image to a post. I copied the example you provide in which you create a media object then update the post attribute. This has no effect on the post.

How do I create a post with text followed by one or more photos at the bottom? Also how do I create a gallery post?!

Thanks!