SOAP
SOAP to REST
Integrate all of your enterprise data on a single secure platform.
See all ConnectorsIntegrate all of your enterprise data on a single secure platform.
See all connectors
by Terence Bennett
July 6, 2018
In this blog post, we’ll show you how to make some simple API calls with the DreamFactory API. The API requires SSL3. If you plan on making requests from cURL, or your native SDK, make sure you are using version 3.
For example, in cURL:
curl -3 url
Your “api key” to talk to our API is your App Name as defined in the DreamFactory Administration Console. For each request, you can:
If your application is not part of the guest user’s role, then access to any service or data components will require authentication.
To authenticate a user, simply POST a JSON string to /user/session that takes on the following format:
{“email”:”email_value”, “password”:”password_value”}
For example:
curl -k -3 -X POST https://dsp-yourdsp.cloud.dreamfactory.com/rest/user/session -H "X-DreamFactory-Application-Name: todojquery" -d "{ "email" : "slimjim@foo.com", "password" : "foo" }"
This will return one of four responses:
You can append app_name=yourappname to the query string or send a request header calledX-DreamFactory-Application-Name.
To refresh a user’s session, or just check to see if they have one, simply do a GET on /user/session.
As you’d expect, getting to your data is just a URL away.
To access any table available to your role, use the following format. In this example, we make a request for the todo table:
GET https://dsp-yourdsp.cloud.dreamfactory.com/rest/db/todo
For example:
curl -3 https://dsp-yourdsp.cloud.dreamfactory.com/rest/db/todo?app_name=todoangular
Important Note: Don’t forget your X-DreamFactory-Application-Name, and if a session is required, your X-DreamFactory-Session-Token header.
If you are doing this cross-domain, enable CORS in the System Configuration section of the DreamFactory Administration Console.
To filter data by field, add an additional url param (filter) as follows. In this example, we make a request for the todo table:
https://dsp-yourdsp.cloud.dreamfactory.com/rest/db/todo?app_name=todoangular&filter=complete=true
This API call returns all todo items that are complete.
Attaching Schema
To attach your table’s schema as metadata in the response, just add a url param, like this:
GET https://dsp-yourdsp.cloud.dreamfactory.com/rest/db/todo?include_schema=true
Important Note: Don’t forget your X-DreamFactory-Application-Name, and if a session is required, your X-DreamFactory-Session-Token header.
Enjoy! If you have any issues, head over to https://dreamfactorysoftware.github.io
Terence Bennett, CEO of DreamFactory, has a wealth of experience in government IT systems and Google Cloud. His impressive background includes being a former U.S. Navy Intelligence Officer and a former member of Google's Red Team. Prior to becoming CEO, he served as COO at DreamFactory Software.
Stay Connected with
The Connector Newsletter!
Subscribe to stay up-to-date with DreamFactory's latest product updates, API best practices, and tech humor in your inbox.