Python calling DreamFactory-mounted APIs

From DreamFactory
Jump to: navigation, search
DreamFactoryTutorialsPython calling DreamFactory-mounted APIs

To seamlessly call DreamFactory-mounted APIs from your Python scripts. You can use the platform's custom data structures to call DreamFactory-hosted APIs like this:

<source lang="python"> api = platform['api']

url = 'mysql/api/v2/employees?limit=5'

result = api.get(url) </source>

This result variable is a Python httplib.HTTPResponse instance. So it would be useful to know what HTTP status code is being returned. You can print it to the log using this statement: <source lang="python"> print result.status </source>