Wowza Community

Create Streaming from api

i try many time but getting error code ERR-400-InvalidJSON

below is url and parameter
let url = “https://api.cloud.wowza.com/api/v1.3/live_streams

let param=[“live_stream”:[“aspect_ratio_height”: 1080,“aspect_ratio_width”: 1920,“billing_mode”: “twentyfour_seven”,“broadcast_location”: “asia_pacific_india”,“encoder”: “wowza_gocoder”,“name”: titleTextField.text!,“transcoder_type”: “transcoded”]]

can you provide code for how to call api in swift?

Can you post the rest of your code for calling the API? Your parameters look fine, but how are you sending the POST?

Here is a full example for you @Ghanem Alshammari:

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"

The curl examples below use environment variables, ${WSC_API_KEY}, ${WSC_ACCESS_KEY}, ${WSC_VERSION}, and ${WSC_HOST} for the Wowza Streaming Cloud API key, access key, version number, and your host.

See Using cURL for more information on how to set these up.

Hope this helps.