Content
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 |
|
Create a file | 201 |
| /blobs | GET |
|
Get files list | 200 |
| (will return from the server) | POST | Upload a file | 201 | |
| /blobs/{blob_id}/complete | POST |
|
Declaring file uploaded | 200 |
| /blobs/{blob_id} | GET |
|
Get information about file by id | 200 |
| /blobs/{uid) | GET |
|
Download File (Get File as a redirect to the S3 object) | 302 |
| /blobs/{blob_id}/getblobobjectbyid | POST |
|
Get File by ID as BlobObjectAccess with read access | 200 |
| /blobs/{blob_id} | PUT |
|
Edit file | 200 |
| /blobs/{blob_id} | DELETE |
|
Delete file | 200 |
| /blobs/{blob_id}/retain | PUT |
|
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 30 chars) | image/jpeg | mime content type |
| blob[name] | Yes | String (min 3 chars. max 30 chars) | museum | File name |
| blob[multipart] | Yes | String | 0 | Must be a string "0" |
Request
curl -X POST -d "blob[content_type]=image/jpeg&blob[name]=111.jpg&blob[multipart]=0&token=ac1cac4219db11c3f0ba80e5fb388ed541457da7" http://api.quickblox.com/blobs.xml
curl -X POST -H "Content-Type: application/json" -d '{"blob": {"content_type": "image/jpeg", "name": "museum.jpeg", "multipart": "0"}, "token": "20e55d804b6bff1cba87cb0215d8967150722ecb" }' 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'/> <tags 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&Policy=eyAiZXhwaXJhdGlvbiI6ICIyMDEyLTA0LTIzVDE2OjI5OjUxWiIsCiAgICAgICJjb25kaXRpb25zIjogWwogICAgICAgIHsiYnVja2V0IjogImJsb2JzLXRlc3Qtb3oifSwKICAgICAgICBbImVxIiwgIiRrZXkiLCAiZTI5ZDEwYTI0YzZiNDYwMmIyNjkyNzVkODYyZDE0MTcwMCJdLAogICAgICAgIHsiYWNsIjogImF1dGhlbnRpY2F0ZWQtcmVhZCJ9LAogICAgICAgIFsiZXEiLCAiJENvbnRlbnQtVHlwZSIsICJpbWFnZS9qcGVnIl0sCiAgICAgICAgeyJzdWNjZXNzX2FjdGlvbl9zdGF0dXMiOiAiMjAxIn0KICAgICAgXQogICAgfQ%3D%3D&Signature=wyKivLZ9wyjjJb0D1y9WCnfktFI%3D&key=e29d10a24c6b4602b269275d862d141700&Content-Type=image%2Fjpeg&acl=authenticated-read&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, "tags": 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 "http://api.quickblox.com/blobs.xml?token=422ce2791d7070b88a82f415b3693c81612e3423"
curl -X GET "http://api.quickblox.com/blobs.json?token=422ce2791d7070b88a82f415b3693c81612e3423"
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> <tags nil="true"></tags> <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, "tags": 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 from the response for the request of the creation a blob
Request & Response
curl -F "key=45b1467ead1c4c7c8abcde01408ae17e00" -F "acl=authenticated-read" -F "success_action_status=201" -F "Filename=111.jpg" -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 |
Request
curl -X PUT -d "http://api.quickblox.com/blobs/159/complete.xml?blob[size]=12231&token=8ba31674849981b7e363e38200aab3fc20dc984f"
curl -X PUT -H "Content-Type: application/json" -d '{"blob": {"size": "86"}, "token": "74b0087b00d748f944429f1c355b91169f5d9d52"}' http://api.quickblox.com/blobs/97/complete.json
Response
Get information about file by id
Get information about file by ID
Request
curl -X GET "http://api.quickblox.com/blobs/300.xml?token=e0e56d95ec5a1bd486a1f3a0672ae9de5b19bd7f"
curl -X GET "http://api.quickblox.com/blobs/300.json?token=6142de6cb6d172227717ae73010dfbb6a07241c5"
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> <tags nil='true'/> <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, "tags": null, "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 is the response of the request for the creating a file
Request & Response
curl -X GET "http://api.quickblox.com/blobs/358d2cba6ca74127a087530f3e82e8d800.xml?token=69217f8cfa59ebbb42d610ccb8ac1e55988cadd7"
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 "http://api.quickblox.com/blobs/41/getblobobjectbyid.xml?token=e0e56d95ec5a1bd486a1f3a0672ae9de5b19bd7f"
curl -X POST -H "Content-Type: application/json" -d '{"token": "74b0087b00d748f944429f1c355b91169f5d9d52"}' http://api.quickblox.com/blobs/301/getblobobjectbyid.json
Response
<?xml version='1.0' encoding='UTF-8'?> <blob-object-access> <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&Expires=1326975552&AWSAccessKeyId=AKIAJHMRS6ZUIQ6VTQDQ </params> </blob-object-access>
{ "blob_object_access": { "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 30 chars) | image/png | Portable Network Graphics; mime content type |
| blob[name] | Optional | String (min 3 chars. max 30 chars) | GreatPlace | File name |
Request
curl -X PUT "http://api.quickblox.com/blobs/131.xml?blob[name]=SuperPhoto&token=32828354d1be7250e9bcef837f9095f6903af59d"
curl -X PUT -H "Content-Type: application/json" -d '{"blob": {"name": "GreatPlace"}, "token": "6142de6cb6d172227717ae73010dfbb6a07241c5"}' 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> <tags nil='true'/> <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, "tags": null, "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 "http://api.quickblox.com/blobs/39/retain.xml?token=69217f8cfa59ebbb42d610ccb8ac1e55988cadd7"
curl -X PUT "{token: 74b0087b00d748f944429f1c355b91169f5d9d52}" http://api.quickblox.com/blobs/102/retain.json?
Response
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 "http://api.quickblox.com/blobs/38.xml?token=69217f8cfa59ebbb42d610ccb8ac1e55988cadd7"
curl -X DELETE "http://api.quickblox.com/blobs/97.json?token=69217f8cfa59ebbb42d610ccb8ac1e55988cadd7"
Response
