How do I attach files to nodes? I need to add files to multiple value file field using drupal rest api (restws module).
return format of restws is something like this :

"field_files": [

    {
        "file": {
            "uri": "http://drupal/file/445",
            "id": "445",
            "resource": "file"
        }
    }
],


but when I send it to http//drupal/node/&lt;node_id&gt; restws returns not acceptable.

Can anyone suggest which format I must use to send data to?

and second question : How can I upload files using restws module ?
For my first question:
I'm sending data with this format and it works now

{
  "field_files":[

    { 
      "fid": "445"
    },

    {
      "fid":"446"
    }
  ]
}


Where fid is the id of an existing and accessible file.

For my second question, I've written module extending restws classes that user can submit data like the way user submits for services rest api.

Idea behind my module is that user submits data and module checks validation data and if data is valid saves file using drupal file_save_data function.