Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can this be used to add podcast episodes to PowerPress? #48

Open
paratechnical opened this issue Apr 26, 2018 · 6 comments
Open

Can this be used to add podcast episodes to PowerPress? #48

paratechnical opened this issue Apr 26, 2018 · 6 comments

Comments

@paratechnical
Copy link

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

@johanmynhardt
Copy link
Contributor

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");.

@paratechnical
Copy link
Author

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

@johanmynhardt
Copy link
Contributor

@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
Copy link
Contributor

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

@paratechnical
Copy link
Author

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

@johanmynhardt
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants