cappslock reported an inability to create topics with tags via the Discourse Admin API, receiving a NoMethodError when using a single tag parameter and having tags ignored when using tags[]. Although tagging was enabled in the UI, the API calls failed to apply tags to the newly created topics. neil initially suggested verifying that tagging was enabled and provided a working curl example using the tags[] parameter format. After cappslock confirmed tagging was active and provided their specific commit hash and request details, neil verified the syntax appeared correct. The investigation shifted to user permissions when cpradio and neil suggested checking the minimum trust level required to tag or create tags. cappslock realized the issue was that the api_username was set to a user with insufficient trust level (the default setting requires Trust Level 3 to create tags), rather than an admin account. Adjusting the trust level or using an admin account resolved the issue.
I have not been able to create a topic with a tag using the admin API (i.e. when I include api_key and api_username on the query string).
POSTing to /posts, I attempted to use the tags[] param I see in the UI’s calls to the API, which were happily ignored. I also tried to post with a tag param which caused the server to 500:
Tagging is enabled, and I have topics with tags that have been created via the UI. I can do this, and it works, but when calling the same API with api_key and api_username in lieu of a user token, it doesn’t work.
No dice. I’m putting the api_key and api_host on the query string, not the body? But I tried to move them and yeah, same result. To be clear, the topic is created, but there aren’t any tags on it.
What commit are you on? Maybe it’s a quirk with the version I’ve checked out? I’m at b1fb1831df5f48aac22d76ad75d6f12edeaf9c03 on the beta branch.
Show me the curl command that isn’t working. I’m not clear if your creating a new topic (POST), updating one (PUT), or adding a reply (can’t add tags to topics from a reply).
Ugh, no, of course not. Minimum trust level to create was set to 3 (the default, I think). Early on I had thought of the admin as being the one creating tags and so assumed it would work, but of course setting api_username to arbitrary users changing that makes sense.