# Create Streaming from api

**URL:** <https://community.wowza.com/t/create-streaming-from-api/53951>\
**Category:** Wowza Developer Dojo\
**Tags:** rest-api\
**Created:** [September 16, 2019, 2:47pm UTC](https://community.wowza.com/t/create-streaming-from-api/53951 "2019-09-16T14:47:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ghanem\_Alshammari](https://avatars.discourse-cdn.com/v4/letter/g/a8b319/32.png) [@Ghanem\_Alshammari](https://community.wowza.com/u/Ghanem_Alshammari)\
**Post date:** [September 16, 2019, 2:47pm UTC](https://community.wowza.com/t/create-streaming-from-api/53951/1 "2019-09-16T14:47:13Z")

</div>

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](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?

---

<div class="post-metadata">

**Author:** ![Amara\_Graham](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/amara_graham/32/381_2.png) [@Amara\_Graham](https://community.wowza.com/u/Amara_Graham)\
**Post date:** [September 16, 2019, 3:30pm UTC](https://community.wowza.com/t/create-streaming-from-api/53951/2 "2019-09-16T15:30:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Rose\_Power-Wowza\_Com](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/rose_power-wowza_com/32/431_2.png) [@Rose\_Power-Wowza\_Com](https://community.wowza.com/u/Rose_Power-Wowza_Com)\
**Post date:** [September 16, 2019, 4:46pm UTC](https://community.wowza.com/t/create-streaming-from-api/53951/3 "2019-09-16T16:46:34Z")

</div>

Here is a full example for you @Ghanem Alshammari:

```auto
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](https://www.wowza.com/docs/How-to-use-the-Wowza-Streaming-Cloud-REST-API#curl) for more information on how to set these up.

Hope this helps.
