# Get contents of HTML file located in /files

**URL:** https://community.dreamfactory.com/t/get-contents-of-html-file-located-in-files/1403
**Category:** REST API
**Created:** [August 21, 2015, 3:58pm UTC](https://community.dreamfactory.com/t/get-contents-of-html-file-located-in-files/1403 "2015-08-21T15:58:02Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![ekh](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/ekh/32/367_2.png) [@ekh](https://community.dreamfactory.com/u/ekh)
#### Post date: [August 21, 2015, 3:58pm UTC](https://community.dreamfactory.com/t/get-contents-of-html-file-located-in-files/1403/1 "2015-08-21T15:58:02Z")

</div>

Having trouble getting the _contents_ of an HTML file I stored in the files depot. Curl works:

```
<pre><code>~ ❯❯❯ curl -i -k 3 -X GET http://localhost:8080/rest/files/applications/cmapp/profile.html -H "X-DreamFactory-Application-Name: cmapp" -H "X-DreamFactory-Session-Token: anq0jjt0a6bv6u9ah51t3g8017"

```

curl: (7) Couldn’t connect to server  
HTTP/1.1 200 OK  
Date: Fri, 21 Aug 2015 15:40:51 GMT  
Server: Apache  
X-Frame-Options: SAMEORIGIN  
X-Powered-By: PHP/5.5.26  
Set-Cookie: PHPSESSID=68qkusa4oi8mv8o1crsrgtr1t4; path=/  
Expires: 0  
Cache-Control: private  
Pragma: public  
Set-Cookie: PHPSESSID=anq0jjt0a6bv6u9ah51t3g8017; path=/  
Last-Modified: Fri, 21 Aug 2015 14:38:14 GMT  
Content-Length: 73  
Content-Disposition: inline; filename=“profile.html”;  
Vary: Accept-Encoding  
Content-Type: text/html;charset=UTF-8

```
This is test data from the server.

%
```

But when trying with the iOS api I either get a nil response or “Cannot process response (-1017)”:

```
func _getProfileHTML() {
    var headerParams = Globals.kHeaderParams
    var session = self.userDefaults.objectForKey(kSessionKey) as! String
    var profileHTML: String!
    
    headerParams["X-DreamFactory-Session-Token"] = session
    println(">>> Inside Sub")
    
    nik.restPath(Globals.kProfileURL,
      method: "GET",
      queryParams: ["content" : "YES", "download" : "YES"],
      body: nil,
      headerParams: headerParams,
      contentType: Globals.kContentTypeJSON,
      completionBlock: {(response: Dictionary!, error: NSError!) in
        if ((error) != nil) {
          profileHTML = "Failed Profile get inside getProfile Block"
          println("error: \(error)")
          self.htmlDelegate?.profileHTMLReturnedWith(profileHTML + ": " + error.localizedDescription)
          self.dbSessionLogout()
        }
        else {
          println(">> DB Session Response: \(response)")
          
          profileHTML = "Got Through"
          self.htmlDelegate?.profileHTMLReturnedWith(profileHTML)
          self.dbSessionLogout()
        }
    })
  }
```

---

<div class="post-metadata">

### Author: ![toddappleton](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/toddappleton/32/159_2.png) [@toddappleton](https://community.dreamfactory.com/u/toddappleton)
#### Post date: [August 26, 2015, 2:57pm UTC](https://community.dreamfactory.com/t/get-contents-of-html-file-located-in-files/1403/2 "2015-08-26T14:57:22Z")

</div>

You can get the file contents in base64 like this:

```
GET /rest/files/applications/myapp/index.html?include_properties=true&content=true

```

The response will look like this:

```
{
	"path": "applications/myapp/index.html",
	"name": "index.html",
	"content_type": "text/html",
	"last_modified": "Mon, 04 May 2015 18:49:31 GMT",
	"content_length": 10305,
	"content": "PGh0bWw+CjxoZWFkPgo8bWV0YSBjaGFyc2V0PSJ1dGYtOCI+C..."
}

```

You would then base64 decode response.content to get the raw HTML.
