I’m working on a python script that uses discourse API to set the status of a post to ‘pinned-globally’, following the API documentation.
The request for ‘pinned-globally’ fails with return code 400, whereas the request with status parameter set to ‘pinned’ works perfectly (i.e. I can see the post locally pinned).
This is the snippet of my code:
apiWebsite = '<my_website_URL>'
apiKey = '<secret>'
apiUsername = '<secret>'
headers = {
'Api-Key': apiKey,
'Api-Username': apiUsername
}
# This request works OK
# Pin the same post locally
payload = {
'status': 'pinned',
'enabled': 'true',
'until': '2019-11-25T08:00:00'
}
u = requests.put(apiWebsite + '/t/29082/status', headers=headers, data=payload)
print(u.status_code)
After having set the pinned status back to false, I try to pin it globally like this.
# This request DOES NOT WORK
# Pin the same topic globally
payload = {
'status': 'pinned-globally',
'enabled': 'true',
'until': '2019-11-25T08:00:00'
}
u = requests.put(apiWebsite + '/t/29082/status', headers=headers, data=payload)
print(u.status_code)
Am I missing something obvious or is it a genuine bug?
P.S. The user has sufficient privileges.