twitchdev / issues

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

Update Shield Mode Status - Incorrect PUT Body and Headers in Documentation #698

Closed gmt2001 closed 1 year ago

gmt2001 commented 1 year ago

Brief description The PUT body and headers in the documentation for Update Shield Mode Status is incorrect

Incorrect documentation

curl -X PUT 'https://api.twitch.tv/helix/moderation/shield_mode?broadcaster_id=12345&moderator_id=98765' \
-H 'Authorization: Bearer kpvy3cjboypmiacwr0c19hotn5s' \
-H 'Client-Id: hof5gwx0su6owfn0yan9c87zr6t' \
-H 'Client-Type: application/json' \
-d '{"data":{"is_active":false}}'

Expected documentation

curl -X PUT 'https://api.twitch.tv/helix/moderation/shield_mode?broadcaster_id=12345&moderator_id=98765' \
-H 'Authorization: Bearer kpvy3cjboypmiacwr0c19hotn5s' \
-H 'Client-Id: hof5gwx0su6owfn0yan9c87zr6t' \
-H 'Content-Type: application/json' \
-d '{"is_active":false}'

Screenshots image

Additional Observation The endpoint will return 200 OK and the body showing the current state (before the attempted state change) of Shield Mode if using the incorrect body defined in the documentation.

I would expect this to return 400 Bad Request

iProdigy commented 1 year ago

I'm able to reproduce the endpoint not doing anything if the body follows the documentation (i.e., {"is_active": true} is correct).

Also, to get the endpoint to work, Content-Type header needs to be present (docs mistakenly do Client-Type)

gmt2001 commented 1 year ago

Also, to get the endpoint to work, Content-Type header needs to be present (docs mistakenly do Client-Type)

Good catch, didn't notice since I was using my bot lib which already did that. Updating OP and forums post

scott-a-white commented 1 year ago

Thanks for letting us know about the issues. The fix will go out in the next doc release.