Update File
This request updates a file, targeted by secure ID.
| patch | /storage/files/{file_sid} |
| put | /storage/files/{file_sid} |
Sample
A sample PATCH request to update the File object, targeted by secure ID, with the values in the request body:
curl -X PATCH \
'https://api.carrierx.com/core/v2/storage/files/2e3b1ecc-6f3e-4be6-a7aa-2f24a9c3e20b' \
-H 'Content-Type: application/json' \
--data-binary '{"name":"new_name"}' \
-H 'Authorization: Bearer 5ebc03d6-8b2b-44ad-bf65-72d4f1491dda'
Response
200 status code with a serialized copy of the updated File object:
{
"container_sid": "cb05c1f4-2398-432c-8314-cc306156281c",
"content_classification": "unknown",
"content_duration": null,
"content_format": "mp3",
"content_transcoding_progress": null,
"date_last_accessed": "2024-07-28T09:02:11.208Z",
"date_modified": "2022-01-22T18:13:30.900Z",
"desired_bitrate": null,
"desired_format": null,
"file_access_name": "f6070be2-9abd-4726-870c-c86c9aac5c7e.mp3",
"file_bytes": 29799,
"file_sid": "f6070be2-9abd-4726-870c-c86c9aac5c7e",
"integer_key_1": null,
"integer_key_2": null,
"lifecycle_action": "no_action",
"lifecycle_ttl": -1,
"mime_type": "audio/mpeg",
"name": "new_name",
"parent_file_sid": null,
"partner_sid": "e00430c3-a7d0-4666-ab5c-f7202448382f",
"publish": "file_sid",
"publish_uri": "http://storage-carrierx.com/f/f6070be2-9abd-4726-870c-c86c9aac5c7e",
"string_key_1": null,
"string_key_2": null,
"string_key_3": null,
"string_key_4": null,
"threshold_include": true,
"type": "file",
"unique": false
}
A File object can be updated using either a PATCH or PUT request.
-
A
PATCHrequest can be used to update one or more attribute values. When using aPATCHrequest, only the attributes specified in the request payload will be updated, all other attributes and values will remain the same. The file secure ID is passed in the query URL, and the values to be modified are passed in the request body. -
A
PUTrequest can be used to update an entire File object. The file secure ID is passed in the query URL, and the entire File object is passed in the request body.
Note, while all the fields must be present in a PUT request, not all the attribute values may be modified after the initial creation, because when created, some of them become read-only.
Required Scopes
To update a File object, the partner must have one of the following scopes enabled:
storage.managestorage.update
Path Arguments
| Parameter | Data Type | Description |
|---|---|---|
| file_sid required | string | The file secure ID. |
Body Arguments
JSON representation of the fields and values to be updated.
Fields that can be modified are:
container_siddesired_formatfile_access_nameinteger_key_1integer_key_2lifecycle_actionlifecycle_ttlmime_typenameparent_file_sidpublishstring_key_1string_key_2string_key_3string_key_4threshold_include
Refer to this table to view all fields that appear in the File object.