Is there an API for bbPress
Hey @casiepa I branched your git hub repo and added a user end point so I can continue development of my mobile bbPress app. I’ve used git hub a lot, but never branched someone else’s repo so I couldn’t quite figure out how to connect them, so I just manually uploaded.
Check it out. After hacking @casiepa’s branch to get user info, I how can view a topic in my mobile bbPress app! I’m getting the user’s avatar, display_name, topic title, date posted, forum name and of course the content of the topic!
I’ve hijacked this thread enough. Going to start one for the app.
I’m a bit swamped in these days, wrapping up my experience overseas and having to move back to the old continent next week.
I’ll have a better look at the latest additions in Pascal’s repo and its fork by @tkserver.
I’m looking forward to see how that all evolves and I’ll be more than happy to contribute, as soon as I’ll have some time.
I’d just love to find some space to discuss about the design aspects of the API too, before diving too much into writing code and risk to bump into limitations late in the process.
I keep reading you with great interest.
s t e
@mapofemergence I really like what you’ve done with your api. It is robust and the documentation is excellent. I’m not sure if my forking of Pascal’s is any good as I’ve never worked on API stuff before, but many years of PHP and WP.
I’ve started a new thread for discussion of my bbPress mobile app here:
I’m excited. Check out the first image I posted in that thread!
My bbpress Api not working. Why..?
it happens to me..?
In addition to reply count I also added the author name and author avatar. That saved a TON of time and http calls. Huge speed increase.
Hi @tkserver, sorry for my silence but in these days I’m a bit swamped with preparing to move back home after some time living and working abroad.
I’m not sure what you mean by where’s my git repo; do you mean this?https://github.com/mapofemergence/BB-REST
I believe it’s linked in my previous post and I see you have starred it, so I might have misunderstood the question. In that case, please expand a bit more 🙂
BTW, in less than one week I’ll be back home so I should be a bit more responsive in replying.
s t e
YES that one. Thanks @mapofemergence no worries. Travel safe. Somehow I lost that link and there is no link from your documentation to the repo. I’ve been there before! Ok I will do some forking.
Ok @mapofemergence it took me a bit to figure out how to fork on github (I use bitbucket normally). Here’s my fork which currently contains the addition of user name, user avatar, and forum name in the topics end point. This results in a huge speed increase over having to hit the forum api and user api while looping through the topics. So I’ve reduced the api calls from 20 down to 1 for a feed of the 10 latest topics!
The routes have slightly changed to comply with standard bbPress settings, but when you get the specific forum, e.g. http://www.example.com/wp-json/bbp-api/v1/forums/forum/5914 it would give you the details of the forum and the list of the 20 recent topics with the title, reply_count, permalink, author and avatar.
I see you also wanted the date posted, so let me add that one too before I commit.
If you see other things to add, let me know. But no guarantee on my response time in these weeks 🙂
PS. are you on slack so we could discuss ?
I’m finding doing paging on forums which have posts and also have subforums to be a pain, LOL.
Paging is my next step, probably this weekend. Why is subforums a pain? You need to list the subforums from the page, then jump to them, no ?
I’ve made my own pagination which then makes sure the http calls are only for the number of records requested. I’m showing the subforums fine, and linking to them. The thing is a forum can be a parent of other forums so it can have posts in it along with the subforums. Somehow the paging is getting broken because I’m not accounting for posts vs subforums. I need to make some logic for that specific scenario.
Well oops. I fell a little silly. I thought my paging was broken in the sub-forum scenario. It wasn’t. Turns out the parent form had only 10 total topics. So when I would go to page 2, there was nothing to show. LOL.
Ok now that we are on the topic of subforums, I see an issue on the API end.
I have a forum which is a parent of about six other forums. That forum has 10 posts in it. The sub forums have 121 posts in them. The total for the parent is showing as 131 because it is counting the subforums. The problem with this is that for my paging I’m using the topic count which breaks the app. The total topics are 131, but there’s only 10 topics to show.
Does that make sense?
Ok @casiepa I’m trying v1.0.3 of your api. Some of the routes are different.
The users routes do not seem to work in 1.0.3
Still checking… Will post more findings if there are any.
This was missing from bbp-api.php:
register_rest_route( 'bbp-api/v1', '/users/(?P<id>\d+)', array( 'methods' => 'GET', 'callback' => 'bbp_api_users_one', ) );
and users.php was also missing.
I’m guessing that was intentional?
I’ve set up a new slack account.
Team URL: tkserver.slack.com
I never had a /users. It need to see how this behaves because I don’t want to open up information of users that might not be public yet.
And for slack, I was not referering to a slack team but just if you were already on wordpress.slack.com . Because it might be easier to discuss things 🙂
Wow am I so brain dead that I created that users end point on my own branch of your version 1.0.2 and don’t even remember? (just read previous posts and yes, apparently I did!) All I’m getting from that service is name and avatar, but that was because those were not in the latest topics or replies. If both of those had author name and avatar, I might have no need for a users endpoint unless one wanted to list posts or replies by user.
I’m very close to releasing a read-only version of my app. A day or two likely.
I just joined the WP slack but that’s way too busy and focused on wp core. I think a separate channel for bbPress or the api would be good.
- You must be logged in to reply to this topic.