Hi,
Is it possible to post anonymously via API? I’m browsing through API doc but can’t find how to do so.
Thanks.
In a discussion titled “Post anonymously via API?” under the Dev category with the tag rest-api, Orachun_Udomkasemsub asks if anonymous posting via API is possible. osioke suggests enabling anonymous mode via API first, then posting as an anonymous user, recommending trial and error and referencing a guide on reverse-engineering the Discourse API. blake confirms it’s possible using either an “all users” API key or a user-specific key for an anonymous username, providing a sample cURL command. Orachun_Udomkasemsub follows up asking whether admins can trace anonymous posts to their original authors. blake replies that this info isn’t exposed in the UI but can be retrieved via a Data Explorer query, linking to a relevant thread for further details.
Hi,
Is it possible to post anonymously via API? I’m browsing through API doc but can’t find how to do so.
Thanks.
Hmm… First time I am seeing this, but I believe it will be possible, but require a 2-step. So you’d first enable anonymous mode via the API, then post using the anonymous account via the API.
You might need to do some trial and error to figure it out, see Reverse engineer the Discourse API for some tips.
Yes, you can post anonymously via the API. You will either have to use an “all users” api key or a “user specific” api key for the actual anonymous username, not the original username of the user.
curl -i -sS -X POST "http://localhost:3000/posts.json" \
-H "Content-Type: multipart/form-data;" \
-H "Api-Key: 48656cfb5197594c71525452e78a403208c4d1a123f60408b765d9c6bd1a9450" \
-H "Api-Username: anonymous1" \
-F "title=b5d39ea5124 4684a27917c d1b81ea2e9e" \
-F "raw=6d9392121129f0ce504583d74e056f5d fe4cf67228216d302509deeca33f0ebc 690106384b6a4204151572e9d4e9da45"
HTTP/1.1 200 OK
Thanks for the response.
Is there anyway that the admin knows who has posted the anonymous post?
I don’t think that info is exposed in the UI anywhere. Looks like you can use a data explorer query though: