Hmmm, it’s not very clear to me what kind of module you’re using to submit your POST request. I use requests and I prepare a post request like I show you here below.
The POST method is to create new posts; PUT is to modify existing posts.
Please check the API documentation here: https://docs.discourse.org/
import requests, json
headers = {
'Content-Type': 'application/json',
'Api-key': envDiscourseKey, # API key passed in this variable
'Api-username': envDiscourseUsername # API user passed in this variable
}
tags = ['first-tag','second-tag']
payload = {
'title': 'Sample title',
'category': 123,
'tags': tags,
'raw': 'Raw text of your post'
}
r = requests.post('https://www.yourwebsite.xyz/posts', headers=headers, data=json.dumps(payload))
returnedData = r.json()
status = r.status_code
Also, as I explained here passing the payload through the params parameter was a mistake on my part and shall not be done.
I hope this helps