API Issue Error 422 Root Key

Getting an error 422

"{"meta":{"status":422,"code":"ERR-422-NoWrappingKey","title":"No Wrapping Key Error","message":"The JSON data you tried to push isn't wrapped in a root key.","description":""},"request_id":"9f009a583a9c50f29546653012189e6d","request_timestamp":"2020-03-08T06:36:41.550Z"}"

My json is though:

"{"live_stream":{"aspect_ratio_height":1080,"aspect_ratio_width":1920,...

I’m sure it’s something silly but I’m lost on it lol.

Any help would be appreciated.

Are you trying to create a live stream? My guess is you are missing your keys in your header - https://www.wowza.com/docs/how-to-broadcast-a-live-stream-by-using-the-wowza-streaming-cloud-rest-api

curl -X POST \
-H "Content-Type: application/json" \
-H "wsc-api-key: ${WSC_API_KEY}" \
-H "wsc-access-key: ${WSC_ACCESS_KEY}" \
-d '{
   "live_stream": {
     "aspect_ratio_height": 1080,
     "aspect_ratio_width": 1920,
     "billing_mode": "pay_as_you_go",
     "broadcast_location": "us_west_california",
     "closed_caption_type": "none",
     "delivery_method": "push",
     "encoder": "wowza_gocoder",
     "hosted_page": true,
     "hosted_page_sharing_icons": true,
     "name": "MyLiveStream",
     "player_responsive": true,
     "player_type": "wowza_player",
     "transcoder_type": "transcoded"
   }
}' "${WSC_HOST}/api/${WSC_VERSION}/live_streams"

In this scenario yes, but I can pull a list of live streams with no issue. So it’s not a key issue.

In this scenario yes, but I can pull a list of live streams with no issue. So it’s not a key issue.

Can you share more details of your workflow since that error code could apply to a few different scenarios? Are you trying to create stream target using the REST API from Engine to Cloud? Or a stream target within Cloud?

More info needed on what you’re trying to accomplish please, so we can try and help. Thank you.

Usually the specific wrapper mention in the error code means an issue with this line: stream_target_wowza.

The first call in the reference article should look like this:

curl -X POST \<br>-H "Content-Type: application/json" \<br>-H "wsc-api-key: ${WSC_API_KEY}" \<br>-H "wsc-access-key: ${WSC_ACCESS_KEY}" \<br>-d '{<br>   "stream_target_wowza": {<br>     "name": "MyCloudHLStarget",<br>     "provider": "akamai_cupertino"<br>   }<br>}' "${WSC_HOST}/api/${WSC_VERSION}/stream_targets/wowza"

But, again just a guess without more info, but please check that article if it applies to your workflow.

@JEAN-MARC PERELMUTER We are migrating to a new forum platform soon and hope you’ll find the UX easier to navigate. I’ve had similar issues.

I see you are using the beta version (1.6) based on your screenshot. Is this happening in 1.5 as well?

Hi @Amara Graham / @Rose Power,

We are experiencing the same issue with all POST requests to the API endpoints. All get requests are working perfectly.

Here’s the screenshot of the Headers and Parameters. I hope you resolve this as soon as possible. Thank you

PARAMETERS:

Also please fix the User Experience issue in this forum. Please hide the Reply Form when the user is not logged in. I re-wrote this response - it is somewhat frustrating. Thanks

I got it working. For those who are using Laravel HTTP client, you can try this:

// Create Stream Target
$response = Http::withHeaders([
            'wsc-api-key' => $apiKey,
            'wsc-access-key' => $accessKey,
            'Content-Type' => 'application/json'
        ])->post( WOWZA_API_URL."/stream_targets/fastly", [
                'stream_target_fastly' => [
                    'name' => 'MyStreamTargets'
                ]
        ],
);

But please fix the user experience issue in this forum. Also when you try to remove the attached image when writing a post or reply, it scrolls back to top instead of staying on the editor section. Thanks

FWIW - I have seen this response when I forgot to specify the content type header as json.

2 Likes