422 Unprocessable Entity when doing put to required_configuration


When trying to put to required configuration endpoint I’m getting 422 error with the following message:

"error": "Unprocessable Entity",
"status": 422,
"message": "{ "status": 422, "message": "Extension activation configuration can't be empty string", "error": "Unprocessable Entity" }"

This is the information I’m using for my call:

headers = {
        "Authorization": "Bearer <signed jwt>",
        "Client-Id": "<extension client id>",
        'Content-Type': 'application/x-www-form-urlencoded'

The payload is urlencoded and matches what I have in my required configuration so I think my call is fine, I’m setting Client-ID, Authorization and Content-Type in headers so my guess is that I’m using wrong the required configuration settings. Currently it looks like this:

poe_username, poe_character_name

In the docs it says that I can put whatever String I want so maybe I’m confusing terms and I’m using it wrong. Could someone explain if this is correct or I should be using it differently?

Thank you very much

Kraken is all JSON so you need to send JSON in the body not a form and you need a space between bearer and the jwt.

I actually tried both and the space is a mistake in the paste, I’ve been using more API’s than that.

Link: Image

Did you do a PUT and actually send some JSON in the body as per the example?

curl -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1MDIyOTg3ODksInVzZXJfaWQiOiIyNzQxOTAxMSIsInJvbGUiOiJleHRlcm5hbCJ9.sKjspl1jw0XGcpjF8vo2IcS2dQLQU_rSsmRCnrohCP4' \
-H 'Client-Id: pxifeyz7vxk9v6yb202nq4cwsnsp1t' \
-H 'Content-Type: application/json' \
-d '{"required_configuration": "RCS-1"}' \
-X PUT https://api.twitch.tv/extensions/pxifeyz7vxk9v6yb202nq4cwsnsp1t/0.0.1/required_configuration?channel_id=27419011

Looking at your link I see you payload is bad

Yes, several times, you can check that in the image I linked above.

Your payload is not:

'{"required_configuration": "A STRING"}' 

Your payload is a bad object.

You shouldn’t be storing the configuration like this…

You need to store the configuration in your EBS and just store a “yay/nay” string in the PUT

See also:

The tool I use to do the requests automatically converts payload to JSON object if content type is set to JSON but that’s not part of th discussion.

Following the guide and changing payload to'{"required_configuration": "myconfig"}' actually did it, thank you very much! Your post explains everything much better than the docs.

Sorry by bad I meant “completely malformed to what the server was expected”

Glad to have been of help! I know Twitch is thinking about allow us to store configs Twitch Server side (as on the linked thread theres a Trello card for it) but right now we can’t