Deleting File

From DreamFactory
Jump to: navigation, search
(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
+
=== 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
+
=== 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
+
=== API Endpoints ===
  
#### Delete a file
+
==== Delete a file ====
  
 
<pre>DELETE http://{url}/api/v2/{storage_service_name}/{folder}/{file}</pre>
 
<pre>DELETE http://{url}/api/v2/{storage_service_name}/{folder}/{file}</pre>
Line 48: Line 48:
 
</source>
 
</source>
  
#### Delete a folder
+
==== Delete a folder ====
  
 
<pre>DELETE http://{url}/api/v2/{storage_service_name}/{folder}/?force=true</pre>
 
<pre>DELETE http://{url}/api/v2/{storage_service_name}/{folder}/?force=true</pre>
Line 73: Line 73:
 
</source>
 
</source>
  
### Example - Delete a file
+
=== Example - Delete a file ===
  
 
* Storage service: files
 
* Storage service: files
Line 102: Line 102:
 
<pre>POST http://foo.com/api/v2/files/docs/</pre>
 
<pre>POST http://foo.com/api/v2/files/docs/</pre>
  
### Example - Delete a folder
+
=== Example - Delete a folder ===
  
 
* Storage service: files
 
* Storage service: files

Revision as of 17:59, 3 February 2016

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

Delete a file

DELETE http://{url}/api/v2/{storage_service_name}/{folder}/{file}

-- OR --

POST http://{url}/api/v2/{storage_service_name}/{folder}/

Request Header:

...
X-HTTP-Method: DELETE
...

Request Body:

{
    "resource":[
        {
            "path":"{folder}/{file}",
            "type":"file"
        }
    ]
}

Delete a folder

DELETE http://{url}/api/v2/{storage_service_name}/{folder}/?force=true

-- OR --

POST http://{url}/api/v2/{storage_service_name}/?force=true

Request Header:

...
X-HTTP-Method: DELETE
...

Request Body:

{
    "resource":[
        {
            "path":"{folder}",
            "type":"folder"
        }
    ]
}

Example - Delete a file

  • Storage service: files
  • File to delete: docs/instruction.pdf
  • Request URL
DELETE http://foo.com/api/v2/files/docs/instruction.pdf

-- OR --

  • Request Header:
...
X-HTTP-Method: DELETE
...
  • Request Body:
{
    "resource":[
        {
            "path":"docs/instruction.pdf",
            "type":"file"
        }
    ]
}
  • Request URL:
POST http://foo.com/api/v2/files/docs/

Example - Delete a folder

  • Storage service: files
  • Folder to delete: docs/temp/
  • Request URL
DELETE http://foo.com/api/v2/files/docs/temp/?force=true

-- OR --

  • Request Header:
...
X-HTTP-Method: DELETE
...
  • Request Body:
{
    "resource":[
        {
            "path":"docs/temp/",
            "type":"folder"
        }
    ]
}
  • Request URL:
POST http://foo.com/api/v2/files/docs/?force=true