@jdorweiler Yea give it a shot.
How do I pick the category to post in? I get a 301 Error when I try this
Posts don’t have categories, but topics do. So if you create a post it will be in whatever category the topic is in. I’m not sure why you are getting that 301.
Ok so topic, still I only see a title/body in the example and but not which category to put the new topic in
@Jared_Needell I’ve updated the documentation to include the category when creating a new topic
Looks like its category id not category slug
Hello everyone, my first post in this forum.
I’m trying to get all posts in a topic with:
This works fine, except for that I only recieve the first 20 posts. I see the info about the rest of the posts under “stream”, but the posts themselves are missing. I can’t find a setting for this anywhere either. Any idea what I’m doing wrong?
Running v1.6.0.beta2 +78 btw.
You will need to pass in all the id’s from the “stream” as url parameters to this url:
I would still make sure you break them up in chunks of 20.
Also I recommend using the ruby discourse_api gem:
So currently there’s no way to request a specific “page” not counting replies?
What I would like to do is get the last 5 posts, plus replies if there are any. But in “stream” i can’t see if a post is a reply or not, correct?
Can’t use the ruby gem I’m afraid, since our project is written in php. I’m stuck with curl.
In the “stream” no, but in the json data for each post there are these fields:
which should help you get the reply info
If we really would like to have native support for this in the api, is there someone we could convince? Or hire?
My problem with this, if I’ve got this right, is that I don’t know which posts that are replies until I’ve retrieved them fully. So if I have a topic with 2000 posts I would have to get all 2000 posts to look for replies to the first post. Well, there is a reply_count so I could be lucky and stop the search when all is found, but worst case scenario is that I have to look through all posts. So it would be really nice to have an api call for this instead, right?
Maybe, but that isn’t a super expensive call to do. You could probably fetch posts in batches of 100+ (or 2000 )
but you could probably just [quote=“mathias.kallberg, post:146, topic:22706”]
get the last 5 posts
and still get what you are looking for.
You could post a topic in the marketplace category here on meta and see if someone is willing to do it.
A quick question: Is there anything you’re not allowed to do via the Master API Key?
My college was trying to create users via the api, and didn’t succeed. After a bit if a struggle he’d created a second api key, for the system user, and got it working, but I wonder if that had anything to do with it?
nope, the master API Key can do all the things.
What was the username he was using with the Master API Key? Even if you are using the Master API Key you still need to pass in a username with it.
His own username I think. So maybe his user didn’t have enough power, could that be it?
If he was using the Master API key though I don’t think it would matter, but if he was using just the api key for his user it would matter.
how can i get list of topic which user’s watch category using api ?
I’m not exactly sure what you are asking for, but to get the categories that a user is watching you can hit the user endpoint and look for these values:
suppose my watched_category_ids 7,8,9
and i want those topic data which in cat_id 7,8,9 in api
Look up the category_slug by their id, and then go to each category and get the topics in them:
will return the topics and contain these fields (plus many more):