Content

Ask tech team
From QuickBlox Developers (API docs, code samples, SDK)
Jump to: navigation, search

Contents

Summary

Content Management

Allows you to manage app contents and settings without having to re-publish them. Using a web interface you or your clients can control and make instant changes to the apps.

  • Manage text, rich text, and media via easy to use web admin panel
  • Can be used to manage ads and banners
  • Control application settings too (variables and parameters can be set to be managed from CMS too)
  • Integrated with Storage module to automatically save the data of any size. Also allows real time streaming of media from cloud storage
  • App synchronizes content in background, users not affected
  • Client library prone to server failure – previous version of content is used when server doesn’t reply or no internet connection is available

Storage and Streaming

Employs the power of Amazon S3 (Simple Storage Service) to store data for your apps.

  • Uses OAuth plus our additional authenticated and encrypted connection channels to deliver data only to authorized users
  • Video streaming – allows real time streaming of content right from cloud storage, no need to download whole file for users
  • Any amount of data can be stored
  • ‘Unlocked content feature’ – typical use case of Storage module is using it to store locked content which is being downloaded after user pays or otherwise unlocks it
  • ‘Content on demand’ – same as with unlocked content feature but to overcome app size limits for media rich apps. User downloads core app with the data getting pulled from cloud storage whenever user needs it

Need to know information

Before using module Content please read the following:

Content API

Typical use сases

To Upload file you need do next steps:

To Download file you need do next steps:


Requests and Responses

URL HTTP Verb Supported formats Action Description Success HTTP Status Code
/blobs POST
  • xml
  • json
Create a file 201
/blobs GET
  • xml
  • json
Get files list 200
/blobs/tagged GET
  • xml
  • json
Get tagged files list 200
(will return from the server) POST Upload a file 201
/blobs/{blob_id}/complete POST
  • xml
  • json
Declaring file uploaded 200
/blobs/{blob_id} GET
  • xml
  • json
Get information about file by id 200
/blobs/{uid) GET
  • xml
  • json
Download File (Get File as a redirect to the S3 object) 302
/blobs/{blob_id}/getblobobjectbyid POST
  • xml
  • json
Get File by ID as BlobObjectAccess with read access 200
/blobs/{blob_id} PUT
  • xml
  • json
Edit file 200
/blobs/{blob_id} DELETE
  • xml
  • json
Delete file 200
/blobs/{blob_id}/retain PUT
  • xml
  • json
Increasing a number of the links to the file 200


Create a file

Create an entity which is a file in a system

Parameters
Param Required Type Value Example Description
blob[content_type] Yes MIMEType (max 50 chars) image/jpeg mime content type
blob[name] Yes String (min 1 chars. max 100 chars) museum File name
blob[public] No String true Blob visibility (by default: false)
blob[tag_list] No String cad,drawing Should be a coma separated string with tags
Request
curl -X POST \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: ac1cac4219db11c3f0ba80e5fb388ed541457da7" \
-d "blob[content_type]=image/jpeg&blob[name]=111.jpg" \
http://api.quickblox.com/blobs.xml
curl -X POST \
-H "Content-Type: application/json" \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: 20e55d804b6bff1cba87cb0215d8967150722ecb" \
-d '{"blob": {"content_type": "image/jpeg", "name": "museum.jpeg"}}' \
http://api.quickblox.com/blobs.json
Response
<?xml version="1.0" encoding="UTF-8"?>
<blob>
  <content-type>image/jpeg</content-type>
  <created-at type='datetime'>2012-04-23T15:29:50Z</created-at>
  <id type='integer'>302</id>
  <last-read-access-ts type='datetime' nil='true'/>
  <lifetime type='integer'>0</lifetime>
  <name>111.jpg</name>
  <public type='boolean'>false</public>
  <ref-count type='integer'>1</ref-count>
  <set-completed-at type='datetime' nil='true'/>
  <size type='integer' nil='true'/>
  <uid>e29d10a24c6b4602b269275d862d141700</uid>
  <updated-at type='datetime'>2012-04-23T15:29:50Z</updated-at>
  <blob-object-access>
    <blob-id type='integer'>302</blob-id>
    <expires type='datetime'>2012-04-23T16:29:50Z</expires>
    <id type='integer'>302</id>
    <object-access-type>Write</object-access-type>
    <params>
      http://blobs-test-oz.s3.amazonaws.com/?AWSAccessKeyId=AKIAJHMRS6ZUIQ6VTQDQ&amp;Policy=eyAiZXhwaXJhdGlvbiI6ICIyMDEyLTA0LTIzVDE2OjI5OjUxWiIsCiAgICAgICJjb25kaXRpb25zIjogWwogICAgICAgIHsiYnVja2V0IjogImJsb2JzLXRlc3Qtb3oifSwKICAgICAgICBbImVxIiwgIiRrZXkiLCAiZTI5ZDEwYTI0YzZiNDYwMmIyNjkyNzVkODYyZDE0MTcwMCJdLAogICAgICAgIHsiYWNsIjogImF1dGhlbnRpY2F0ZWQtcmVhZCJ9LAogICAgICAgIFsiZXEiLCAiJENvbnRlbnQtVHlwZSIsICJpbWFnZS9qcGVnIl0sCiAgICAgICAgeyJzdWNjZXNzX2FjdGlvbl9zdGF0dXMiOiAiMjAxIn0KICAgICAgXQogICAgfQ%3D%3D&amp;Signature=wyKivLZ9wyjjJb0D1y9WCnfktFI%3D&amp;key=e29d10a24c6b4602b269275d862d141700&amp;Content-Type=image%2Fjpeg&amp;acl=authenticated-read&amp;success_action_status=201
    </params>
  </blob-object-access>
  <blob-status/>
</blob>
{
  "blob": {
    "blob_status": null,
    "content_type": "image/jpeg",
    "created_at": "2012-04-23T13:22:34Z",
    "id": 315,
    "last_read_access_ts": null,
    "lifetime": 0,
    "name": "111.jpg",
    "public": false,
    "ref_count": 1,
    "set_completed_at": null,
    "size": null,
    "uid": "30a8bcd7c714417eb62b95350d7e13b900",
    "updated_at": "2012-04-23T13:22:34Z",
    "blob_object_access": {
      "blob_id": 315,
      "expires": "2012-04-23T14:22:34Z",
      "id": 315,
      "object_access_type": "Write",
      "params": "http://qbprod.s3.amazonaws.com/?AWSAccessKeyId=AKIAIY7KFM23XGXJ7R7A&Policy=eyAiZXhwaXJhdGlvbiI6ICIyMDEyLTA0LTIzVDE0OjIyOjM0WiIsCiAgICAgICJjb25kaXRpb25zIjogWwogICAgICAgIHsiYnVja2V0IjogInFicHJvZCJ9LAogICAgICAgIFsiZXEiLCAiJGtleSIsICIzMGE4YmNkN2M3MTQ0MTdlYjYyYjk1MzUwZDdlMTNiOTAwIl0sCiAgICAgICAgeyJhY2wiOiAiYXV0aGVudGljYXRlZC1yZWFkIn0sCiAgICAgICAgWyJlcSIsICIkQ29udGVudC1UeXBlIiwgImltYWdlL2pwZWciXSwKICAgICAgICB7InN1Y2Nlc3NfYWN0aW9uX3N0YXR1cyI6ICIyMDEifQogICAgICBdCiAgICB9&Signature=eBtgK1jAzsGNcFjpqEGiTLnm008%3D&key=30a8bcd7c714417eb62b95350d7e13b900&Content-Type=image%2Fjpeg&acl=authenticated-read&success_action_status=201"
    }
  }
}


Get Files List

Get list of files for the current user. The ID of the user is taken from the token specified in the request

Request
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: 422ce2791d7070b88a82f415b3693c81612e3423" \
http://api.quickblox.com/blobs.xml
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: 422ce2791d7070b88a82f415b3693c81612e3423" \
http://api.quickblox.com/blobs.json
Response
<blobs type="array" current_page="1" per_page="10" total_entries="16">
  <blob>
    <content-type>image/png</content-type>
    <created-at type="datetime">2012-03-23T16:14:41Z</created-at>
    <id type="integer">44</id>
    <last-read-access-ts type="datetime">2012-03-27T13:14:08Z</last-read-access-ts>
    <lifetime type="integer">86400</lifetime>
    <name>image</name>
    <public type="boolean">true</public>
    <ref-count type="integer">1</ref-count>
    <set-completed-at type="datetime">2012-03-23T16:14:51Z</set-completed-at>
    <size type="integer">4221</size>
    <uid>859146a9821e4bef9c6d60e1e8c88b3c00</uid>
    <updated-at type="datetime">2012-03-27T12:14:20Z</updated-at>
    <blob-status>complete</blob-status>
  </blob>
  <blob>
    ...
  </blob>
  ...
</blobs>
{
  "current_page": 1,
  "per_page": 10,
  "total_entries": 6,
  "items": [
    {
      "blob": {
        "blob_status": null,
        "content_type": "image/jpeg",
        "created_at": "2012-04-23T13:20:44Z",
        "id": 313,
        "last_read_access_ts": "2012-04-23T14:20:44Z",
        "lifetime": 0,
        "name": "111.jpg",
        "public": false,
        "ref_count": 1,
        "set_completed_at": null,
        "size": null,
        "uid": "29d739b7ff2b4f83bb4cf2416b46238e00",
        "updated_at": "2012-04-23T13:20:44Z"
      }
    },
      "blob": {
        ...
      }
    },
      ...
      }
    }
  ]
}


Get Tagged Files List

Get list of tagged files for current user. Will be returned files which have the same tags as current user

Request
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: 422ce2791d7070b88a82f415b3693c81612e3423" \
http://api.quickblox.com/blobs/tagged.xml
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: 422ce2791d7070b88a82f415b3693c81612e3423" \
http://api.quickblox.com/blobs/tagged.json
Response
<blobs type="array" current_page="1" per_page="10" total_entries="16">
  <blob>
    <content-type>image/png</content-type>
    <created-at type="datetime">2012-03-23T16:14:41Z</created-at>
    <id type="integer">44</id>
    <last-read-access-ts type="datetime">2012-03-27T13:14:08Z</last-read-access-ts>
    <lifetime type="integer">86400</lifetime>
    <name>image</name>
    <public type="boolean">true</public>
    <ref-count type="integer">1</ref-count>
    <set-completed-at type="datetime">2012-03-23T16:14:51Z</set-completed-at>
    <size type="integer">4221</size>
    <uid>859146a9821e4bef9c6d60e1e8c88b3c00</uid>
    <updated-at type="datetime">2012-03-27T12:14:20Z</updated-at>
    <blob-status>complete</blob-status>
  </blob>
  <blob>
    ...
  </blob>
  ...
</blobs>
{
  "current_page": 1,
  "per_page": 10,
  "total_entries": 6,
  "items": [
    {
      "blob": {
        "blob_status": null,
        "content_type": "image/jpeg",
        "created_at": "2012-04-23T13:20:44Z",
        "id": 313,
        "last_read_access_ts": "2012-04-23T14:20:44Z",
        "lifetime": 0,
        "name": "111.jpg",
        "public": false,
        "ref_count": 1,
        "set_completed_at": null,
        "size": null,
        "uid": "29d739b7ff2b4f83bb4cf2416b46238e00",
        "updated_at": "2012-04-23T13:20:44Z"
      }
    },
      "blob": {
        ...
      }
    },
      ...
      }
    }
  ]
}



Upload a file

Upload a file with the params of BlobObjectAccess info to make a possibility to create items with a content.

Parameters

Use params and url from blob-object-access params element from the response for the request of the creation a blob

Request & Response
curl -X POST -F "key=45b1467ead1c4c7c8abcde01408ae17e00" -F "acl=authenticated-read" -F "success_action_status=201" -F "AWSAccessKeyId=AKIAIY7KFM23XGXJ7R7A" -F "Policy=eyAiZXhwaXJhdGlvbiI6ICIyMDEyLTAxLTE5VDE0OjMzOjMzWiIsCiAgICAgICJjb25kaXRpb25zIjogWwogICAgICAgIHsiYnVja2V0IjogInFicHJvZCJ9LAogICAgICAgIFsiZXEiLCAiJGtleSIsICI0NWIxNDY3ZWFkMWM0YzdjOGFiY2RlMDE0MDhhZTE3ZTAwIl0sCiAgICAgICAgeyJhY2wiOiAiYXV0aGVudGljYXRlZC1yZWFkIn0sCiAgICAgICAgWyJlcSIsICIkQ29udGVudC1UeXBlIiwgImltYWdlL2pwZWciXSwKICAgICAgICB7InN1Y2Nlc3NfYWN0aW9uX3N0YXR1cyI6ICIyMDEifQogICAgICBdCiAgICB9" -F "Signature=p0MlUS20qaLFBDrqHgIu1F9NMtQ%3D" -F "Content-Type=image/jpeg" -F "file=@111.jpg"  http://qbprod.s3.amazonaws.com/
<PostResponse>
  <Location>
    https://blobs-test-oz.s3.amazonaws.com/d5f92bcf84374e4fb8961537f7a7de6500
  </Location>
  <Bucket>blobs-test-oz</Bucket>
  <Key>d5f92bcf84374e4fb8961537f7a7de6500</Key>
  <ETag>"de1aae3e6beadb83bc8e1e21eb7e2a66"</ETag>
</PostResponse>


Declaring file uploaded

Declaring file uploaded. Set file status to 'Complete'. If the specified file size does not match to the actual, the actual will be set

Parameters
Param Required Type Value Example Description
blob[size] Yes Unsigned Integer 123213 Size of uploaded file, in bytes
Request
curl -X PUT \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: 8ba31674849981b7e363e38200aab3fc20dc984f" \
-d "blob[size]=12231" \
http://api.quickblox.com/blobs/159/complete.xml
curl -X PUT \
-H "Content-Type: application/json" \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: 74b0087b00d748f944429f1c355b91169f5d9d52" \
-d '{"blob": {"size": "86"}}' \
http://api.quickblox.com/blobs/97/complete.json
Response
Empty body, status: 200
Status: 200, null


Get information about file by id

Get information about file by ID

Request
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: e0e56d95ec5a1bd486a1f3a0672ae9de5b19bd7f" \
http://api.quickblox.com/blobs/300.xml
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: 6142de6cb6d172227717ae73010dfbb6a07241c5" \
http://api.quickblox.com/blobs/300.json
Response
<?xml version='1.0' encoding='UTF-8'?>
<blob>
  <content-type>image/jpeg</content-type>
  <created-at type='datetime'>2012-04-23T15:23:12Z</created-at>
  <id type='integer'>300</id>
  <last-read-access-ts type='datetime'>2012-04-23T16:26:51Z</last-read-access-ts>
  <lifetime type='integer'>0</lifetime>
  <name>111.jpg</name>
  <public type='boolean'>false</public>
  <ref-count type='integer'>1</ref-count>
  <set-completed-at type='datetime'>2012-04-23T15:26:51Z</set-completed-at>
  <size type='integer'>83050</size>
  <uid>ce0eae3beadc4232ada7b39316f16bc300</uid>
  <updated-at type='datetime'>2012-04-23T15:26:51Z</updated-at>
  <blob-status>complete</blob-status>
</blob>
{
  "blob": {
    "blob_status": "complete",
    "content_type": "image/jpeg",
    "created_at": "2012-04-23T15:23:12Z",
    "id": 300,
    "last_read_access_ts": "2012-04-23T16:26:51Z",
    "lifetime": 0,
    "name": "111.jpg",
    "public": false,
    "ref_count": 1,
    "set_completed_at": "2012-04-23T15:26:51Z",
    "size": 83050,
    "uid": "ce0eae3beadc4232ada7b39316f16bc300",
    "updated_at": "2012-04-23T15:26:51Z"
  }
}


Download File (Get File as a redirect to the S3 object)

Download File (Get File as a redirect to the S3 object) by uid. 'uid' is a parameter which should be taken from the response of the request for the creating a file. To have a possibility to download a file you should set a status complete to your file firstly.

Request
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: 69217f8cfa59ebbb42d610ccb8ac1e55988cadd7" \
http://api.quickblox.com/blobs/358d2cba6ca74127a087530f3e82e8d800.xml
curl -X GET \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: 69217f8cfa59ebbb42d610ccb8ac1e55988cadd7" \
http://api.quickblox.com/blobs/358d2cba6ca74127a087530f3e82e8d800.json


Response

301 redirect to file

Get File by ID as BlobObjectAccess with read access

Get File by ID as BlobObjectAccess with read access. Then we can use info from params element for download file.

Request
curl -X POST \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: e0e56d95ec5a1bd486a1f3a0672ae9de5b19bd7f" \
http://api.quickblox.com/blobs/41/getblobobjectbyid.xml
curl -X POST \
-H "Content-Type: application/json" \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: 74b0087b00d748f944429f1c355b91169f5d9d52" \
http://api.quickblox.com/blobs/301/getblobobjectbyid.json
Response
<?xml version='1.0' encoding='UTF-8'?>
<blob-object-access>
 <id type='integer'>
    41
  </id>  
 <blob-id type='integer'>
    41
  </blob-id>
  <expires type='datetime'>
    2012-01-19T12:19:12Z
  </expires>
  <object-access-type>
    Read
  </object-access-type>
  <params>
    https://blobs-test-oz.s3.amazonaws.com:443/cb7d34d946544d5bafd2843d6291ef2000?Signature=RydtB4H%2BjZEHBwZt4wUWSyRAFRw%3D&amp;Expires=1326975552&amp;AWSAccessKeyId=AKIAJHMRS6ZUIQ6VTQDQ
  </params>
</blob-object-access>
{
  "blob_object_access": {
    "id": 97,
    "blob_id": 97,
    "expires": "2012-03-22T17:35:43Z",
    "object_access_type": "Read",
    "params": "https://blobs-test-oz.s3.amazonaws.com:443/49d386c6cc68437a9fcae66ce7edfa8b00?Signature=ZRKS05Fvlu5n8Cx2yTh7JQAZr7k%3D&Expires=1332437743&AWSAccessKeyId=AKIAJHMRS6ZUIQ6VTQDQ"
  }
}


Edit file

Edit a file by ID

Param Required Type Value Example Description
blob[content_type] Optional MIMEType (max 50 chars) image/png Portable Network Graphics; mime content type
blob[name] Optional String (min 1 chars. max 100 chars) GreatPlace File name
blob[tag_list] Optional String cad,drawing Should be a coma separated string with tags
blob[new] Optional Integer 1 Use it to update blob file
Request
curl -X PUT \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: 32828354d1be7250e9bcef837f9095f6903af59d" \
-d "blob[name]=SuperPhoto" \
http://api.quickblox.com/blobs/131.xml
curl -X PUT \
-H "Content-Type: application/json" \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: 6142de6cb6d172227717ae73010dfbb6a07241c5" \
-d '{"blob": {"name": "GreatPlace"}}' \
http://api.quickblox.com/blobs/101.json
Response
<?xml version='1.0' encoding='UTF-8'?>
<blob>
  <content-type>image/jpeg</content-type>
  <created-at type='datetime'>2012-04-03T13:05:39Z</created-at>
  <id type='integer'>131</id>
  <last-read-access-ts type='datetime'>2012-04-03T14:20:52Z</last-read-access-ts>
  <lifetime type='integer'>0</lifetime>
  <name>SuperPhoto</name>
  <public type='boolean'>false</public>
  <ref-count type='integer'>1</ref-count>
  <set-completed-at type='datetime'>2012-04-03T13:11:47Z</set-completed-at>
  <size type='integer'>56529</size>
  <uid>31bdb84e31a642c29b76be87262a480000</uid>
  <updated-at type='datetime'>2012-04-03T13:22:56Z</updated-at>
  <blob-status>complete</blob-status>
</blob>
{
  "blob": {
    "blob_status": "complete",
    "content_type": "image/jpeg",
    "created_at": "2012-03-23T08:26:10Z",
    "id": 101,
    "last_read_access_ts": "2012-03-23T09:28:21Z",
    "lifetime": 0,
    "name": "GreatPlace",
    "public": false,
    "ref_count": 2,
    "set_completed_at": "2012-03-23T08:28:22Z",
    "size": 221526,
    "uid": "43b0870a000f4218a8f6a8287c1f65af00",
    "updated_at": "2012-03-23T08:34:17Z"
  }
}


Increasing a number of the links to the file

Increasing a number of the links to the file

Request
curl -X PUT \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: 69217f8cfa59ebbb42d610ccb8ac1e55988cadd7" \
http://api.quickblox.com/blobs/39/retain.xml
curl -X PUT \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: 74b0087b00d748f944429f1c355b91169f5d9d52" \
http://api.quickblox.com/blobs/102/retain.json
Response
Empty body, status: 200
Empty body, status: 200, null


Delete file

Delete file by ID. If there are some referents to the file the number of links will be reduced by 1 after deleting. A file will be deleted in fact when the number of links will be equal to 0.

Request
curl -X DELETE \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: 69217f8cfa59ebbb42d610ccb8ac1e55988cadd7" \
http://api.quickblox.com/blobs/38.xml
curl -X DELETE \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-H "QB-Token: 69217f8cfa59ebbb42d610ccb8ac1e55988cadd7" \
http://api.quickblox.com/blobs/97.json
Response
Empty body, status: 200
Empty body, status: 200