Downloading File
(Created page with "### Tutorial DreamFactory 2.0 allows you to expose various storage services as API Endpoints. The following storage services are currently supported. * Local Storage (conf...") |
|||
Line 1: | Line 1: | ||
− | + | === Tutorial === | |
DreamFactory 2.0 allows you to expose various storage services as API Endpoints. The following storage services are currently | DreamFactory 2.0 allows you to expose various storage services as API Endpoints. The following storage services are currently | ||
Line 10: | Line 10: | ||
* Rackspace Cloud Files | * Rackspace Cloud Files | ||
− | + | === Provisioning a Storage Service === | |
All DreamFactory 2.0 instances come pre-configured with a 'Local Storage' service named 'files'. You can find this service | All DreamFactory 2.0 instances come pre-configured with a 'Local Storage' service named 'files'. You can find this service | ||
Line 21: | Line 21: | ||
storage service - 'files'. | storage service - 'files'. | ||
− | + | === API Endpoints === | |
− | + | ==== Downloading a binary file ==== | |
<pre>GET http://{url}/api/v2/{storage_service_name}/{folder}/{file}?download=true</pre> | <pre>GET http://{url}/api/v2/{storage_service_name}/{folder}/{file}?download=true</pre> | ||
− | + | ==== Downloading a folder as Zip file ==== | |
<pre>GET http://{url}/api/v2/{storage_service_name}/{folder}/?zip=true</pre> | <pre>GET http://{url}/api/v2/{storage_service_name}/{folder}/?zip=true</pre> | ||
− | + | ==== Reading a file ==== | |
<pre>GET http://{url}/api/v2/{storage_service_name}/{folder}/{text_file}</pre> | <pre>GET http://{url}/api/v2/{storage_service_name}/{folder}/{text_file}</pre> | ||
− | + | === Example - Downloading a binary file === | |
* Storage service: files | * Storage service: files | ||
Line 43: | Line 43: | ||
<pre>GET http://foo.com/api/v2/files/images/logo.jpg?download=true</pre> | <pre>GET http://foo.com/api/v2/files/images/logo.jpg?download=true</pre> | ||
− | + | === Example - Downloading a folder as zip file === | |
* Storage service: files | * Storage service: files | ||
Line 50: | Line 50: | ||
<pre>GET http://foo.com/api/v2/files/images/?zip=true</pre> | <pre>GET http://foo.com/api/v2/files/images/?zip=true</pre> | ||
− | + | === Example - Reading a file === | |
* Storage service: files | * Storage service: files |
Revision as of 17:58, 3 February 2016
Contents
Tutorial
DreamFactory 2.0 allows you to expose various storage services as API Endpoints. The following storage services are currently supported.
- Local Storage (configurable to use local file system, S3, Azure, or Rackspace)
- AWS S3
- Azure Blob
- OpenStack Object Storage
- Rackspace Cloud Files
Provisioning a Storage Service
All DreamFactory 2.0 instances come pre-configured with a 'Local Storage' service named 'files'. You can find this service on the admin console, under the services tab. You can also provision as many other storage services as you like using the admin console. Login to the admin console and select the 'Services' tab. Click on the 'Create' button from the left menu. On the service creation form select your storage type from the 'Service Type' drop down box (File section). Enter a short, one-word, meaningful name for your service as well as a label and description. Depending on which storage type you pick, you will need to enter the service configuration values on the 'Config' tab. Create your storage service after entering all your configuration values. Your storage service is now ready for action. For this tutorial, we will use the pre-configured storage service - 'files'.
API Endpoints
Downloading a binary file
GET http://{url}/api/v2/{storage_service_name}/{folder}/{file}?download=true
Downloading a folder as Zip file
GET http://{url}/api/v2/{storage_service_name}/{folder}/?zip=true
Reading a file
GET http://{url}/api/v2/{storage_service_name}/{folder}/{text_file}
Example - Downloading a binary file
- Storage service: files
- Folder: images
- File: logo.jpg
- Request URL:
GET http://foo.com/api/v2/files/images/logo.jpg?download=true
Example - Downloading a folder as zip file
- Storage service: files
- Folder: images
- Request URL:
GET http://foo.com/api/v2/files/images/?zip=true
Example - Reading a file
- Storage service: files
- Folder: documents
- File: readme.txt
- Request URL:
GET http://foo.com/api/v2/files/documents/readme.txt