How to attach/upload a file to node using restws? I've got a content type with "File" field and "File" widget. I am successfully able to create a node without a file using restws. But, if I want to attach a file to it, it just doesn't allow me to do that. I've tried many different things, but with failure. 

Also, when accessing a node with file already attached to it, using get request (e.g. {domain_name}/node/219.json), the file field is displayed as an empty element, even though file is existing and is displayed fine when viewing the node in edit mode from admin area. 

E.g. 

JSON:

"field_simple_file":[]


XML:

&lt;field_simple_file/&gt;


The node array without file field, that succeeds is as below:

$new_node = array(
    'body' =&gt; array(),
    'type' =&gt; 'simple',
    'title' =&gt; 'Content created with restws',
    'language' =&gt; 'und',
    'status' =&gt; 1,
    'promote' =&gt; 0,
    'sticky' =&gt; 0,
    'author' =&gt; 1    
);


And content-type:

'Content-Type: application/json'


But I think, I am not 100% sure on how to include a file in it (have tried few different things), which might be leading to failure. Can anyone provide me with guidance for attaching/uploading a file with restws please?
Here is the URL to access a node with file already attached to it  

{domain_name}/[end-point]/node/219.json 

Here 219 is the nid of the node.

Here is the sample JSON format to attach a file to node (node create).

{
    "title": "title_of_node",
    "type": "bundle_name",
    "field_samplefile": {
        "und": [{
            "fid": "17",
            "filename": "changes.txt",
            "uri": "public://changes.txt",
            "filemime": "text/plain"
        }]
    }
}