Packaging
From DreamFactory
(Created page with "=== Tutorial === Packaging in DreamFactory allows for easily exporting various system resources from one instance and importing them to another. === API Endpoint === == Ex...") |
|||
Line 5: | Line 5: | ||
=== API Endpoint === | === API Endpoint === | ||
− | == Export a Package Manifest only == | + | ==== Export a Package Manifest only ==== |
<pre> | <pre> | ||
GET https://your-url/api/v2/system/package | GET https://your-url/api/v2/system/package | ||
</pre> | </pre> | ||
− | == Export a Package == | + | ==== Export a Package ==== |
<pre> | <pre> | ||
POST https://your-url/api/v2/system/package | POST https://your-url/api/v2/system/package | ||
Line 24: | Line 24: | ||
</source> | </source> | ||
− | == Import a Package == | + | ==== Import a Package ==== |
<pre> | <pre> | ||
POST https://your-url/api/v2/system/package?import_url=<package url> | POST https://your-url/api/v2/system/package?import_url=<package url> |
Revision as of 16:15, 18 April 2016
Contents
- 1 Tutorial
- 2 API Endpoint
- 3 Example - Export a Package Manifest
- 4 Example - Export a Package Manifest for system services only
- 5 Example - Export a Package with various resources
- 6 Example - Exporting Package resources using id
- 7 Example - Exporting Package resources using filter
- 8 Example - Exporting Package resources with related data
- 9 Example - Exporting Package resources with related data using filter
- 10 Example - Exporting storage resources in Package
- 11 Example - Exporting schemas from database service
- 12 Example - Storing exported package using a storage service
- 13 Example - Storing exported package using a storage service and a custom filename
- 14 Example - Exporting a Package securely
- 15 Example - Importing a Package using multipart/form-data
- 16 Example - Importing a secured Package using multipart/form-data
- 17 Example - Importing a Package using URL import
- 18 Example - Importing a secured Package using URL import
- 19 Example - Importing a Package from command line
- 20 Example - Importing a secured Package from command line
Tutorial
Packaging in DreamFactory allows for easily exporting various system resources from one instance and importing them to another.
API Endpoint
Export a Package Manifest only
GET https://your-url/api/v2/system/package
Export a Package
POST https://your-url/api/v2/system/package
{ "service":{ "system":{ "role":[1,2,3] } } }
Import a Package
POST https://your-url/api/v2/system/package?import_url=<package url>
-- OR --
Using multipart/form-data POST
curl --form files=@myfile.zip http://your-url/api/v2/system/package
Example - Export a Package Manifest
GET http://foo.com/api/v2/system/package
Example - Export a Package Manifest for system services only
GET http://foo.com/api/v2/system/package?system_only=true
Example - Export a Package with various resources
POST http://foo.com/api/v2/system/package
{ “service": { "system": { "role": [“role1”,“role2”], "service": [ “DB", “mailgun", “script", “s3", “mysql", “math-py" ], "app": [“add_angular2",“my-test-app"], "user": [“john+github@dreamfactory.com",“john@foo.com"], "admin": ["john@dreamfactory.com"], "custom": ["adminPreferences"], "cors": [6,7], "email_template": [“test_email_template","test_template"], "event": [ "mydb._table.contact.{id}.patch.pre_process", "user.register.post.post_process" ], "lookup": ["host","user"] }, "DB": { "_schema": [“contact_group","contact_info"] }, "mydb": { "_schema": [“contact","todo"] }, "mysql": { "_schema": [“contact","todo"] }, "files": [ "applications/", "projects/", "testfiles.zip" ], "s3": [ "my_images/", "work/" ] } }
Example - Exporting Package resources using id
POST http://foo.com/api/v2/system/package
{ “service”:{ “system”:{ “role”:[1,2,3] // Exporting roles with id 1,2,3 } } }
Example - Exporting Package resources using filter
POST http://foo.com/api/v2/system/package
{ “service”:{ “system”:{ “service”:{ “filter”:”name like ’test_%’” } } } }
POST http://foo.com/api/v2/system/package
{ “service”:{ “system”:{ “role”:{ “ids”:[1,2,3], // Exporting roles with id 1,2,3 “related”:[ “app_by_role_id”, “role_service_access_by_role_id” ] } } } }
POST http://foo.com/api/v2/system/package
{ “service”:{ “system”:{ … “role”:{ “filter”:”name like ’test_%’”, “related”:[ “app_by_role_id”, “role_service_access_by_role_id” ] } } } }
Example - Exporting storage resources in Package
POST http://foo.com/api/v2/system/package
{ “service”:{ “files”:[ // Name of your storage service “css/”, // Storage folders to export “assets/“, “images/buttons/“, “app.js”, // Storage files to export “index.html” ] } }
Example - Exporting schemas from database service
POST http://foo.com/api/v2/system/package
{ “service”:{ “db”:{ // Name of your database service “_schema”:[ // Export _schema resource “table1”, // Name of your tables “table2”, “table3” ] } } }
Example - Storing exported package using a storage service
POST http://foo.com/api/v2/system/package
{ “storage”:{ “name”:”s3”, // Name of the storage service “folder”:”my-exports”, // Folder to store your package in }, “service”:{ “system”:{ “role”:[1,2,3] // Exporting roles with id 1,2,3 … } } }
Example - Storing exported package using a storage service and a custom filename
POST http://foo.com/api/v2/system/package
{ “storage”:{ “name”:”s3”, // Name of the storage service “folder”:”my-exports”, // Folder to store your package in “filename”:”my-package.zip” // Name of your package file }, “service”:{ “system”:{ “role”:[1,2,3] // Exporting roles with id 1,2,3 } } }
Example - Exporting a Package securely
POST http://foo.com/api/v2/system/package
{ “secured”:true, // Set this true for secure package “password”:”secret”, // Must provide a password for secure package “service”:{ “system”:{ “service”:[“db”,”s3”] // Service configs are encrypted } } }
Example - Importing a Package using multipart/form-data
curl --form files=@myfile.zip http://foo.com/api/v2/system/package
Example - Importing a secured Package using multipart/form-data
curl --form files=@myfile.zip password=secret http://foo.com/api/v2/system/package
Example - Importing a Package using URL import
POST http://foo.com/api/v2/system/package?import_url=http://foobar.com/packages/my-package.zip
Example - Importing a secured Package using URL import
POST http://foo.com/api/v2/system/package?import_url=http://foobar.com/packages/my-package.zip?password=secured
Example - Importing a Package from command line
php artisan dreamfactory:import-pkg /path/to/package/folder_or_file_or_url
Example - Importing a secured Package from command line
php artisan dreamfactory:import-pkg /path/to/package/folder_or_file_or_url --password=secret