# Post/create multiple objects

**URL:** <https://community.wowza.com/t/post-create-multiple-objects/46794>\
**Category:** Wowza Developer Dojo\
**Created:** [June 27, 2016, 10:51am UTC](https://community.wowza.com/t/post-create-multiple-objects/46794 "2016-06-27T10:51:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![philip\_curley](https://avatars.discourse-cdn.com/v4/letter/p/8dc957/32.png) [@philip\_curley](https://community.wowza.com/u/philip_curley)\
**Post date:** [June 27, 2016, 10:51am UTC](https://community.wowza.com/t/post-create-multiple-objects/46794/1 "2016-06-27T10:51:06Z")

</div>

Is it possible to use the REST API to create multiple Wowza objects using a single POST request? I’ve looked around for examples or documentation and I have tried some test calls, but I have been unsuccessful. If possible, I’d rather send 1 request with an array of objects to the server rather than looping through my data and sending another POST request.

If it matters, I am interested in creating multiple stream files or multiple transcoder templates.

Here is an example I tried:

```auto
curl -H "Content-Type: application/json" -X POST "http://wowza:port/v2/servers/{servername}/vhosts/{vhost}/applications/{applicationname}/streamfiles" -d
'[{
  "name": "stream_file1",
  "uri": "uri://1"
},
{
  "name": "stream_file1",
  "uri": "uri://1"
},
{
  "name": "stream_file1",
  "uri": "uri://1"
}]'

```

Wowza sends a malformed syntax response. Is there something I’m missing in my data? is something like this even possible?

---

<div class="post-metadata">

**Author:** ![Paul\_Shields](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/paul_shields/32/390_2.png) [@Paul\_Shields](https://community.wowza.com/u/Paul_Shields)\
**Post date:** [July 27, 2016, 2:06pm UTC](https://community.wowza.com/t/post-create-multiple-objects/46794/2 "2016-07-27T14:06:15Z")

</div>

Hi,

I don’t believe that is possible. The endpoint has the name of the stream file you’re adding at the end of the URI, for example adding the stream file axis.stream

```auto
curl -X POST --header 'Accept:application/json; charset=utf-8' --header 'Content-type:application/json; charset=utf-8' http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/streamfiles/axis -d'
{
   "restURI": "http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/streamfiles",
   "streamFiles": [
      {
         "id": "connectAppName= live&appInstance=_definst_&mediaCasterType=rtp",
         "href": "http://localhohst:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/streamfiles/connectAppName=live&appInstance=_definst_&mediaCasterType=rtp"
      }
   ]
}'

```

Regards,

Paul

---

<div class="post-metadata">

**Author:** ![philip\_curley](https://avatars.discourse-cdn.com/v4/letter/p/8dc957/32.png) [@philip\_curley](https://community.wowza.com/u/philip_curley)\
**Post date:** [July 27, 2016, 9:56am UTC](https://community.wowza.com/t/post-create-multiple-objects/46794/3 "2016-07-27T09:56:26Z")

</div>

> I don’t believe that is possible. The endpoint has the name of the stream file you’re adding at the end of the URI, for example adding the stream file axis.stream

I don’t believe this is necessarily true. Perhaps my first POST data was malformed now that I see it again, but I can use the /streamfiles endpoint to add a single stream file. Something like this (test application is ‘Recorder’):

```auto
curl -X POST "http://server_address/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/Recorder/streamfiles" -d 
    {
      "name": "stream_test",
      "uri": "/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/Recorder/streamfiles/stream_test"
    }

```

Something like this will simple create single stream file named “stream\_test.stream” in my Recorder application.

Is it not possible to create a JSON array of “name” and “uri” to create a number of stream files using one request? how would I format this JSON array of multiple streamfiles?

Here is my updated test.

```auto
curl -X POST "http://server_address/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/Recorder/streamfiles" -d
{
  "streamFiles": [
     {
       "id": "stream_b",
       "href": "/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/Recorder/streamfiles/stream_b"
     },
     {
       "id": "stream_a",
       "href": "/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/Recorder/streamfiles/stream_a"
     }
  ]
}

```

I actually get a response of success = true, but I do not see these stream files (stream\_a.stream, stream\_b.stream) added to my application. I am not sure why the server is returning success, in this case.

---

<div class="post-metadata">

**Author:** ![Michelle\_B](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/michelle_b/32/394_2.png) [@Michelle\_B](https://community.wowza.com/u/Michelle_B)\
**Post date:** [July 27, 2016, 11:51am UTC](https://community.wowza.com/t/post-create-multiple-objects/46794/4 "2016-07-27T11:51:44Z")

</div>

Hi,

Unfortunately, that REST API endpoint does not currently support an array list of values. I will raise this with our Engineering team to add this as an enhancement in a future release, and to add the correct error return code for now.

Michelle
