Recipes
Replace file with new file
1. Use a `blob` parameter to set blob fields
curl -X PUT \
-H "Content-Type: application/json" \
-H "QB-Token: f8dd521e8a88b0df7e0c359dc3de73fc15012bba" \
-d '{
"blob":{
}
}' \
https://api.quickblox.com/blobs/10119859.json
2. Update a file content to new
Set a new to 1
in the blob to update the file content. curl -X PUT \
-H "Content-Type: application/json" \
-H "QB-Token: f8dd521e8a88b0df7e0c359dc3de73fc15012bba" \
-d '{
"blob":{
"new":"1"
}
}' \
https://api.quickblox.com/blobs/10119859.json
3. As a result, the file is replaced with a new one.
{
"blob" : {
"id" : 10119859 ,
"uid" : "5b40013845324e798902f9bf94fc687b00" ,
"content_type" : "image/jpeg" ,
"name" : "apple.jpeg" ,
"size" : 6743 ,
"created_at" : "2020-09-15T11:12:00Z" ,
"updated_at" : "2020-09-15T11:12:12Z" ,
"blob_status" : null ,
"set_completed_at" : "2020-09-15T11:12:02Z" ,
"public" : true ,
"account_id" : 102190 ,
"app_id" : 74829 ,
"blob_object_access" : {
"id" : 10119859 ,
"blob_id" : 10119859 ,
"expires" : "2020-09-15T12:12:12Z" ,
"object_access_type" : "Write" ,
"params" : "https://api.quickblox.com/blobs/10119859/upload/?acl=public-read&content_type=image%2Fjpeg&expires=2020-09-15%2012%3A12%3A12%20UTC&key=5b40013845324e798902f9bf94fc687b00&policy=YTAyMTM4ZGUyNzk2ZWRmZDA4MTg0NjQ2OGUwYTZhNjk%3D%0A&success_action_status=201&x-amz-algorithm=AWS4-HMAC-SHA256&x-amz-credential=160e31c718a12f1b46e8b347fea52e4d%2F20200915%2Fqbprod%2Fs3%2Faws4_request&x-amz-date=2020259T1212Z&x-amz-signature=a6d47838690dffcec8cb0a7d2059faaa"
}
}
}
1. Use a `blob` parameter to set blob fields
curl -X PUT \
-H "Content-Type: application/json" \
-H "QB-Token: f8dd521e8a88b0df7e0c359dc3de73fc15012bba" \
-d '{
"blob":{
}
}' \
https://api.quickblox.com/blobs/9715927.json
2. Set a new file name
Set a new file name
in the blob. curl -X PUT \
-H "Content-Type: application/json" \
-H "QB-Token: f8dd521e8a88b0df7e0c359dc3de73fc15012bba" \
-d '{
"blob":{
"name":"apple"
}
}' \
https://api.quickblox.com/blobs/9715927.json
3. As a result, the API returns a file with an updated name.
{
"blob" : {
"id" : 9715867 ,
"uid" : "9dc0d37c9be34c839ae3bcac4bbaace100" ,
"content_type" : "image/jpeg" ,
"name" : "apple" ,
"size" : 16766 ,
"created_at" : "2019-09-15T19:40:18Z" ,
"updated_at" : "2019-09-15T20:35:45Z" ,
"blob_status" : "complete" ,
"set_completed_at" : "2019-09-15T20:00:46Z" ,
"public" : false
}
}
Update a file name, content type or file tag list. You can also update the file content by setting new=1
parameter. Once set, the file is deleted in the cloud storage and a new record is created. Consequently,
all file fields, except for the name
, are updated in the cloud storage including the uid
, size
, etc.
Path Parameters
ID of the file/blob. Generated automatically by the server after file/blob creation.
Body Parameters
Should be a comma-separated string with tags.
Use it to update the content of the blob file. Set new=1
to proceed.
A user or application session token. See
Authentication page to learn more about session tokens. Must be used either QB-Token or Authorization.
Responses
curl -X PUT \
-H "Content-Type: application/json" \
-H "QB-Token: ee0959fe70ddaf8d1a04e8ed6425bdd9f4012bba" \
-d '{
"blob":{
"name":"apple"
}
}' \
https://api.quickblox.com/blobs/9715927.json
{
"blob" : {
"id" : 9715867 ,
"uid" : "9dc0d37c9be34c839ae3bcac4bbaace100" ,
"content_type" : "image/jpeg" ,
"name" : "apple" ,
"size" : 16766 ,
"created_at" : "2019-09-15T19:40:18Z" ,
"updated_at" : "2019-09-15T20:35:45Z" ,
"blob_status" : "complete" ,
"set_completed_at" : "2019-09-15T20:00:46Z" ,
"public" : false
}
}