wp-api-v2-client-java icon indicating copy to clipboard operation
wp-api-v2-client-java copied to clipboard

Can this be used to add podcast episodes to PowerPress?

Open paratechnical opened this issue 6 years ago • 6 comments

https://forum.blubrry.com/index.php?topic=3466.0 I read here that you need to add information to custom fields in order to do this

`$enclosure_value = $row['url']; $enclosure_value .= "\n"; $enclosure_value .= $row['size']; $enclosure_value .= "\n"; $enclosure_value .= $type;

    $content['title'] = $title;
    $content['description'] = $body;
    $content['categories'] = array("Meetings");
    /*Pass custom fields*/
    $content['custom_fields'] = array(
        array( 'key' => 'enclosure', 'value' => $enclosure_value )
        );`

Can this be done using this java library? Thank you

paratechnical avatar Apr 26 '18 09:04 paratechnical

Hi @paratechnical, if you look at com.afrozaar.wordpress.wpapi.v2.Client and the meta methods, you'll be able to do that.

So you'll for example use client.createMeta(postId, "enclosure", "enclosure value");.

johanmynhardt avatar Apr 26 '18 10:04 johanmynhardt

Hi @johanmynhardt , what if there is no postid, what if I am creating it now? Do I create it first and then add the meta? Is there a documentation or an example somewhere that I can check out? Thanks

paratechnical avatar Apr 26 '18 12:04 paratechnical

@paratechnical you can have a look in /src/test/java/com/afrozaar/wordpress/wpapi/v2/ClientLiveIT.java#L358

You do need a post. This is something required by the wordpress REST API.

johanmynhardt avatar Apr 26 '18 12:04 johanmynhardt

@paratechnical that ClientLiveIT class is where you'll get all the cases that I had to make it work with.

johanmynhardt avatar Apr 26 '18 12:04 johanmynhardt

@johanmynhardt Do you have any idea why PostMeta createdMeta = client.createMeta(createdPost.getId(), key, value); might crash with a 404 error?

paratechnical avatar May 06 '18 12:05 paratechnical

It could be a permission issue or the rest endpoint could have an issue.

If you initialised the client with debugging enabled, you should be able to see more information about the request and response.

johanmynhardt avatar May 06 '18 13:05 johanmynhardt