Open ConnorKrammer opened 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.
Duplicate of #708 (also see comment for language tag workaround)
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.
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:
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-emptytags
array, but passing an empty array causes it to be ignored. If thetags
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:
tags: null
results in identical behaviour totags: []
tags: {}
gives the same result astags: []
ortags: null
tags: { 0: 'tagname' }
is identical totags: ['tagname']
.tags: { 'unset': 'please' }
, then the API will finally capitulate and unset all the channel's tags. This works for any object, so long as there's no0
or'0'
field, because then it falls back to the array-like case just before this one.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, settingtags
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.