XF 2.2 API to get threads by node ID?

Fullmental

Active member
We've been reading through the endpoint documentation trying to find a way to automatically move threads in a certain node that are inactive for more than 30 days to an archive node. We thought we could do this with the REST API, but I'm not seeing any parameters in the GET threads call that allows us to specify a node ID. I do see the option to get threads with activity older than X days, just not in a specific node.


Is there an unwritten parameter there, or is there another way we can achieve this natively in the XF software, without relying on paid addons? We've been burned a few times lately on lack of update support for those so we really don't want to rely on that.
 
You can use the forum API for this:

That...doesn't seem very efficient? As far as I can tell this would return a list of ALL threads in the entire forum, which we'd then have to parse through to get the node IDs for. Wouldn't that negatively impact the response time for a large forum? We'd get a response set with over 20,000 threads every time we ran it, versus maybe a hundred or so that we actually want to look at. What kind of performance impact can we expect from such a query?
 
The endpoint will return a single page of threads from a single node, so you wouldn't need to process the node IDs unless I'm misunderstanding. You can fetch subsequent pages using the page parameter if desired (or process a page at a time).
 
Ahhh, I see. What I am calling nodes the API calls "forums". I guess the terms are interchangeable in a sense? The thread data type calls it a node ID so I was looking for ways to filter by "node ID" specifically.

If so that makes much more sense. Thank you!
 
Last edited:
Right, I get that. I'm just saying that in the Thread[] data type, it's called a "node" ID, and in the GET requests it's a "forum" ID. I had assumed a named value in the Thread[] data type would be consistent across the entire API, and thus you could make a GET request for threads by node ID.
 
Last edited:
was there a solution to this?

looks like there are endpoints that will allow you to grab all threads from a specific node (forum) but not an endpoint to grab all the threads from a specific category (parent node)

get latest threads:
/api/threads

get latest threads from a specific forum:
api/forums/{node_id}/threads

get latest threads from a specific category/parent node:
i.e. all the threads from all of the forums that fall under sponsors or another category
an example within this community is this page: https://xenforo.com/community/#xenforo-bug-reports.46

no clear api endpoint :( but something like:
api/categories/{node_id}/threads
 
Back
Top Bottom