# How do add StreamFiles on Restful on Java HTTP Request ?

**URL:** <https://community.wowza.com/t/how-do-add-streamfiles-on-restful-on-java-http-request/48257>\
**Category:** Wowza Streaming Engine\
**Created:** [March 13, 2017, 8:23am UTC](https://community.wowza.com/t/how-do-add-streamfiles-on-restful-on-java-http-request/48257 "2017-03-13T08:23:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Umut\_BAYRAM](https://avatars.discourse-cdn.com/v4/letter/u/3ec8ea/32.png) [@Umut\_BAYRAM](https://community.wowza.com/u/Umut_BAYRAM)\
**Post date:** [March 13, 2017, 8:23am UTC](https://community.wowza.com/t/how-do-add-streamfiles-on-restful-on-java-http-request/48257/1 "2017-03-13T08:23:21Z")

</div>

Hi,

I want to adding stream files on restfull on Java.

**Example :**

**Curl**

curl -X DELETE --header ‘Accept:application/json; charset=utf-8’ [http://localhost:8087/v2/servers/](http://localhost:8087/v2/servers/)_defaultServer_/vhosts/_defaultVHost_/applications/Deneme/streamfiles/umut

**Java**

String url = “[http://localhost:8087/v2/servers/](http://localhost:8087/v2/servers/)_defaultServer_/vhosts/_defaultVHost_/applications/Deneme/streamfiles/umut”; URL obj = new URL(url); String authString = “admin:123456”; HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod(“DETELE”); con.setRequestProperty(“Authorization”, "Basic " + new String(Base64.encodeBase64(authString.getBytes()))); con.setRequestProperty(“Accept”, “application/json”); con.setRequestProperty(“charset”, “utf-8”); con.setDoOutput(true); // Read URL BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close();

Its works. But the code below is not working.

String url = “[http://localhost:8087/v2/servers/](http://localhost:8087/v2/servers/)_defaultServer_/vhosts/_defaultVHost_/applications/Deneme/streamfiles/umut”; URL obj = new URL(url); String authString = “admin:123456”; String jsonData = “{ “restURI”: “[http://localhost:8087/v2/servers/](http://localhost:8087/v2/servers/)_defaultServer_/vhosts/_defaultVHost_/applications/Deneme/streamfiles”, “streamFiles”: [{ “id”: “connectAppName= Deneme&appInstance=_definst_&mediaCasterType=rtp”, “href”: “[http://localhohst:8087/v2/servers/](http://localhohst:8087/v2/servers/)_defaultServer_/vhosts/_defaultVHost_/applications/Deneme/streamfiles/connectAppName=Deneme&appInstance=_definst_&mediaCasterType=rtp” } ]}”; HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod(“POST”); con.setRequestProperty(“Authorization”, "Basic " + new String(Base64.encodeBase64(authString.getBytes()))); con.setRequestProperty(“Accept”, “application/json”); con.setRequestProperty(“charset”, “utf-8”); con.setDoOutput(true); con.setDoInput(true); OutputStream os = con.getOutputStream(); os.write(jsonData.getBytes(“UTF-8”)); os.close(); // Read URL BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); con.disconnect();

Any idea ?

Thanks.
