Jason Gilmore - September 4, 2019

DreamFactory includes a web-based administration console used for performing tasks such as managing APIs, administrators, and business logic. However many users prefer to instead automate administrative tasks through scripting. This is useful for several reasons. First, automation reduces the amount of work required to manage multiple DreamFactory environments. Second, it opens up the possibility of integrating DreamFactory features into third-party applications such as an API monetization SaaS. In this post we’ll demonstrate just how easy managing your DreamFactory instance using the system APIs can really be.

Did you know you can generate a full-featured, documented, and secure REST API in minutes using DreamFactory? Sign up for our free 14 day hosted trial to learn how! Our guided tour will show you how to create an API using an example database provided to you as part of the trial!

Create Your REST API Now

{
"resource":[
{
"id":null,
"name":"mysql",
"label":"MySQL API",
"description":"MySQL API",
"is_active":true,
"type":"mysql",
"config":{
"max_records":1000,
"host":"HOSTNAME",
"port":3306,
"database":"DATABASE",
"username":"USERNAME",
"password":"PASSWORD"
},
"service_doc_by_service_id":null
}
]
}

Be sure to update the HOSTNAME, DATABASE, USERNAME, and PASSWORD placeholders to reflect the credentials associated with your MySQL database. Of course, you’re not limited to creating just MySQL APIs; any of DreamFactory’s supported service types can be created and managed using the system APIs. After submitting a successful request, a 201 Created status code is returned along with the newly created service’s ID:

{
"resource": [
{
"id": 194
}
]
}

We invite you to check out the latest chapter in our guide, creatively titled “Using the System APIs” for more examples like this, including a Bash shell scripting example which could serve as the starting point for automating management of a multi-environment DreamFactory solution.