I’m using the Patreon PHP Api to get all the posts from my patreon page and it is working sort of.
I’m getting the posts and Id’s but when i ask for the post data i don’t get any attributes.
I don’t know what i’m doing wrong. Can someone help me?
People, you can see documentation for publish, update, delete webhooks here:
You must specifically request various fields which you need when using api v2.
Here is what WP plugin uses to get a post details that will be in the upcoming post sync feature:
?fields[post]=title,content,is_paid,is_public,published_at,url,embed_data,embed_url,app_id,app_status
That does not work. I’m using the Patreon API PHP Library.
Are you using a v2 token with v2 endpoints?
Yes, I’m getting attributes now but i’m only getting the first 20 posts
I really only need the last comment every time because i’m storing them in my own DB.
The get_posts function in api class in the upcoming post sync feature in WordPress plugin is an example of how to paginate posts:
You can use that example to request other pages. Also the api doc for pagination helps:
When i add ?sort=created
to the end of campaigns/{$campaign_id}/posts
and change it between created
and -created
it does nothing to the order.
What am i doing wrong?
Ordering may or may not have been implemented for posts endpoint. You should try different ordering methods out.
So what should i use to get the first posts from patreon?
Just check out the functions get_posts and get_post in upcoming post sync branch of WP plugin:
They are working examples that you can use to get posts.
As i said, ordering may not have been implemented, so it may not work.
Is there a method for retrieving comments on a post? I did not see this in the API docs nor libraries.
Comments, tags, attachments etc are not yet supported at posts endpoint.
Thank you, @codebard !
I am curious: will webhooks be implemented at some point in the future for new published posts and post updates?
It feels like a webhook approach would work well for NEW and updated stuff and calling the API directly for existing/archive stuff to populate WordPress or other site.
Webhooks are already implemented for new posts and updates?