Which Drupal Rest API property in the JSON request controls Drupal's File status (Temporary and Permanent) logic?
I am trying to upload via Multipart/form-data (i.e. JSON data plus attached [uploaded] file) to Drupal 8.1.x CMS. So far, the upload is successful. However, In Drupal uploaded files (via REST) are initially stored by default with "TEMPORARY" status.
I want to tell Drupal to set the status of the file to "PERMANENT" when it stores my file into the Drupal CMS. I did some searching and found out that the keyword "status" in File.php did the magic around TEMPORARY and PERMANENT. So far, I have been including the property "status" in my Json request but Drupal generates an Internal error --> message:
"Access denied on creating field 'status'"
after having set "status": [{"value": "1"}]
BTW: I have tried different variations on the value representation of "value", that is "1", 1, true, "true", ..., since I was not able to get more information about the API specification specific to the Rest File upload interface.
I have searched Drupal site for a solution but with no satisfying results yet.
Question: Does anyone know how to construct the JSON request with status PERMANENT?
This is a bug, which can be fixed in the following Drupal source file:
References
Files created with REST API are only temporary [#2756127] | Drupal.org
MIME type not set when file uploaded with REST API [#2754775] | Drupal.org
File Entity (fieldable files) | Drupal.org
How to upload image using REST resources for File resource '/entity/file/{file}'? [#2682341] | Drupal.org