twitchdev / issues

Issue tracker for third party developers.
Apache License 2.0
73 stars 6 forks source link

Modify Channel Information endpoint cannot clear all tags #995

Open ConnorKrammer opened 1 month ago

ConnorKrammer commented 1 month ago

Brief description

The Modify Channel Information endpoint can be used to modify a channel's tags, which includes removing them. The documentation states the following:

To remove all tags from the channel, set tags to an empty array.

Contrary to this, setting the tags field to [] results in no change to the information returned by the complementary Get Channel Information endpoint. Channel tags will update if you pass a non-empty tags array, but passing an empty array causes it to be ignored. If the tags field is the only field being set for a given request to the endpoint, then the endpoint will return an HTTP 400 "The request must update at least one channel property field." error, despite that the field has been explicitly included.

These observations about how the endpoint reacts to different inputs should give some insight into what's going wrong on the server's end:

How to reproduce

Make a request to the Modify Channel Information endpoint. Set tags to a non-empty list of tags. Make a second request, setting tags to an empty list. Check the tags, and observe that they remain as set in the first request, and have not been unset as they should.

Expected behavior

Setting the tags field in the request body to an empty array should unset all channel tags.

ConnorKrammer commented 1 month ago

Incidentally, while poking at this, I noticed that the "too many tags" error message could use some attention:

Twitch API Error: HTTP 400 "The parameter "tags" was malformed: the value must be less than or equal to 10"

It's not critically bad, so I'm not opening a new issue for it, but it could absolutely be clearer. It seems to suggest tags is an integer that must be <= 10, but in truth the restriction is on the length of the tags list, not its value. Hope that's helpful.

iProdigy commented 1 month ago

Duplicate of #708 (also see comment for language tag workaround)

ConnorKrammer commented 1 month ago

Good to know about the other issue. Above, where I document how the endpoint behaves when provided different values for the tags field, I describe another workaround that doesn't require knowledge of the channel's language tag. You can set tags to be an object with at least one field, making sure not to name any field 0 or '0':

{ tags: { 'please': 'unset all tags' } }

Not nearly as good as if the endpoint were fixed, alas.