Another thing: how do I authenticate when doing POST requests? What error codes can be returned for POST or PUT requests?
To answer my own questions after reading the source code:
API docs are pretty sparse, this stuff should really be documented better.
You can also add it to the form body.
Thanks for your help in improving that!
The thing is that most of the people who are intimately familiar with the API are busy improving it. ️
Discourse is pretty fast moving.
Agreed! In fact we are actively working on this together with @oblakeerickson. But like @pfaffman pointed out we're always on the move, so we're making sure the new API documentation flow can easily keep up with our development pace.
I want to find a user's received likes by api But likes aren't in user's details.where should I find it?
You can get the count of likes:
thank you.Where did you find this?Is there a complete documention of API?
just use the developer tools in your browser and watch the XHR filter on the network tab.
Can we change the topic's owner with API?HOW?
I don't think this is possible through the PUT topic api calls. You can modify other values like the title and category_id, but not the username.
curl 'http://localhost:3000/t/15/change-owner' --data 'post_ids%5B%5D=1074&username=Mobileboy'
ahh awesome, thanks! I didn't know change-owner existed. As an admin on a topic click the wrench --> select posts --> (select the posts you want to change) --> change ownership --> type in the new username
Is there any method to authenticate a username and password with API?
How can we set the auto-closing time for one specific topic_id with the API?
Lets say the topic_id 60 should auto-close in 48 hours. All other topics in the this Category are on 24h auto-close.
Second Question: how can we make a specific topic sticky with the API?
Perform these actions in your browser while the Network tab of the developer tools is open to find out
I want to reply topics with api and change owner of the reply from admin to an email address(Email address may not be in database so the owner will be a stage user).and if the email address is one of the user's email address, change the owner from admin to the user.Is it possible with api?
Changing a post owner is very similar to changing the topic owner:
A better approach might be to assign each user their own api key and they can just post as themselves. Doing everything as an admin is kind of dangerous.
How is it possible?
how can we assign each user an api key?