---
title: "View source for System Api Examples - DreamFactory Wiki"
source: "https://wiki.dreamfactory.com/index.php?action=edit&title=System_Api_Examples"
canonical_url: "https://wiki.dreamfactory.com/index.php?action=edit&title=System_Api_Examples"
converted_at: "2026-11-24T03:08:07.850Z"
format: "markdown"
converted_by: "html-to-md-ai"
---
[]()
	
	
	
	# View source for System Api Examples

	
		
		← [System Api Examples](/System_Api_Examples)
		
		
		
		[Jump to navigation](#mw-head)
		[Jump to search](#searchInput)
		You do not have permission to edit this page, for the following reason:

The action you have requested is limited to users in the group: [Users](/index.php?title=DreamFactory_Wiki:Users&action=edit&redlink=1).---

You can view and copy the source of this page.

{{#seo:
|title=Live API Examples - DreamFactory Documentation
|title_mode=replace
|description=Real curl examples with real responses from a live DreamFactory 7.4.2 instance. Covers auth, service management, data queries, and API discovery.
|keywords=curl examples, live API, DreamFactory examples, data query, service creation, authentication
|og:title=Live API Examples
|og:type=article
|og:site_name=DreamFactory Documentation
|og:description=Real curl examples with real responses from a live DreamFactory 7.4.2 instance. Covers auth, service management, data queries, and API discovery.
}}
'''Real curl examples with real responses from a live DreamFactory 7.4.2 instance. Covers auth, service management, data queries, and API discovery.'''

&lt;span id="live-api-examples">&lt;/span>
= Live API Examples =

&lt;blockquote>All examples verified against a live DreamFactory 7.4.2 instance. Responses are real, trimmed for brevity.
&lt;/blockquote>
&lt;blockquote>⚠️ '''Shell quoting gotcha:''' Using &lt;code>-d '{&amp;quot;email&amp;quot;:...}'&lt;/code> can silently fail on some shells — the JSON body arrives but DF doesn't parse it. Always use &lt;code>-d @file.json&lt;/code> for reliability.
&lt;/blockquote>

-----

&lt;span id="setup">&lt;/span>
== Setup ==

&lt;syntaxhighlight lang="bash">APIKEY="your-admin-app-api-key"

# Write payload to file — avoids shell quoting issues
cat > /tmp/login.json &lt;&lt; 'EOF'
{"email":"admin@example.com","password":"yourpassword"}
EOF

TOKEN=$(curl -s -X POST http://your-df-host/api/v2/system/admin/session \
  -H "Content-Type: application/json" \
  -H "X-DreamFactory-API-Key: $APIKEY" \
  -d @/tmp/login.json | python3 -c "import sys,json; print(json.load(sys.stdin)['session_token'])")&lt;/syntaxhighlight>

-----

&lt;span id="system-info">&lt;/span>
== System Info ==

&lt;span id="get-df-version-and-environment">&lt;/span>
=== Get DF Version and Environment ===

&lt;syntaxhighlight lang="bash">curl -s http://your-df-host/api/v2/system/environment \
  -H "X-DreamFactory-API-Key: $APIKEY" \
  -H "X-DreamFactory-Session-Token: $TOKEN"&lt;/syntaxhighlight>
'''Real response (trimmed):'''

&lt;syntaxhighlight lang="json">{
  "platform": {
    "version": "7.4.2",
    "is_hosted": false
  }
}&lt;/syntaxhighlight>

-----

&lt;span id="service-management">&lt;/span>
== Service Management ==

&lt;span id="list-all-services">&lt;/span>
=== List All Services ===

&lt;syntaxhighlight lang="bash">curl -s "http://your-df-host/api/v2/system/service?fields=id,name,type,label" \
  -H "X-DreamFactory-API-Key: $APIKEY" \
  -H "X-DreamFactory-Session-Token: $TOKEN"&lt;/syntaxhighlight>
'''Real response:'''

&lt;syntaxhighlight lang="json">{
  "resource": [
    {"id": 1, "name": "system",   "type": "system",      "label": "System Management"},
    {"id": 2, "name": "api_docs", "type": "swagger",     "label": "Live API Docs"},
    {"id": 3, "name": "files",    "type": "local_file",  "label": "Local File Storage"},
    {"id": 4, "name": "logs",     "type": "local_file",  "label": "Local Log Storage"},
    {"id": 5, "name": "db",       "type": "sqlite",      "label": "Local SQL Database"},
    {"id": 6, "name": "email",    "type": "local_email", "label": "Local Email Service"},
    {"id": 7, "name": "user",     "type": "user",        "label": "User Management"}
  ]
}&lt;/syntaxhighlight>
The &lt;code>name&lt;/code> field becomes the URL namespace: &lt;code>/api/v2/{name}/&lt;/code>.

&lt;span id="list-all-available-service-types">&lt;/span>
=== List All Available Service Types ===

&lt;syntaxhighlight lang="bash">curl -s "http://your-df-host/api/v2/system/service_type?fields=name,label,group" \
  -H "X-DreamFactory-API-Key: $APIKEY" \
  -H "X-DreamFactory-Session-Token: $TOKEN"&lt;/syntaxhighlight>
'''Real response — use &lt;code>name&lt;/code> as the &lt;code>type&lt;/code> field when creating services:'''

{| class="wikitable"
|-
! name
! label
! group
|-
| &lt;code>mysql&lt;/code>
| MySQL
| Database
|-
| &lt;code>pgsql&lt;/code>
| PostgreSQL
| Database
|-
| &lt;code>sqlite&lt;/code>
| SQLite
| Database
|-
| &lt;code>mssql&lt;/code>
| MS SQL Server
| Database
|-
| &lt;code>alloydb&lt;/code>
| AlloyDB
| Database
|-
| &lt;code>aws_dynamodb&lt;/code>
| AWS DynamoDB
| Database
|-
| &lt;code>aws_redshift_db&lt;/code>
| AWS Redshift
| Database
|-
| &lt;code>cassandra&lt;/code>
| Cassandra
| Database
|-
| &lt;code>couchdb&lt;/code>
| CouchDB
| Database
|-
| &lt;code>azure_documentdb&lt;/code>
| Azure DocumentDB
| Database
|-
| &lt;code>azure_table&lt;/code>
| Azure Table Storage
| Database
|-
| &lt;code>firebird&lt;/code>
| Firebird
| Database
|-
| &lt;code>aws_s3&lt;/code>
| AWS S3
| File
|-
| &lt;code>azure_blob&lt;/code>
| Azure Blob Storage
| File
|-
| &lt;code>local_file&lt;/code>
| Local File Storage
| File
|-
| &lt;code>ftp_file&lt;/code>
| FTP File Storage
| File
|-
| &lt;code>sftp_file&lt;/code>
| SFTP File Storage
| File
|-
| &lt;code>webdav_file&lt;/code>
| WebDAV File Storage
| File
|-
| &lt;code>openstack_object_storage&lt;/code>
| OpenStack Object Storage
| File
|-
| &lt;code>rackspace_cloud_files&lt;/code>
| Rackspace Cloud Files
| File
|-
| &lt;code>rws&lt;/code>
| HTTP Service
| Remote Service
|-
| &lt;code>mcp&lt;/code>
| MCP Server Service
| MCP
|-
| &lt;code>aws_ses&lt;/code>
| AWS SES
| Email
|-
| &lt;code>local_email&lt;/code>
| Local Email Service
| Email
|-
| &lt;code>mailgun_email&lt;/code>
| Mailgun
| Email
|-
| &lt;code>smtp_email&lt;/code>
| SMTP
| Email
|-
| &lt;code>aws_sns&lt;/code>
| AWS SNS
| Notification
|-
| &lt;code>oauth_github&lt;/code>
| GitHub OAuth
| OAuth
|-
| &lt;code>oauth_google&lt;/code>
| Google OAuth
| OAuth
|-
| &lt;code>oauth_facebook&lt;/code>
| Facebook OAuth
| OAuth
|-
| &lt;code>oauth_microsoft-live&lt;/code>
| Microsoft Live OAuth
| OAuth
|-
| &lt;code>cache_redis&lt;/code>
| Redis
| Cache
|-
| &lt;code>cache_memcached&lt;/code>
| Memcached
| Cache
|-
| &lt;code>amqp&lt;/code>
| AMQP Client
| IoT
|-
| &lt;code>mqtt&lt;/code>
| MQTT Client
| IoT
|}

&lt;span id="create-a-mysql-service">&lt;/span>
=== Create a MySQL Service ===

&lt;syntaxhighlight lang="bash">cat > /tmp/mysql_svc.json &lt;&lt; 'EOF'
{
  "resource": [{
    "name": "mysql",
    "label": "MySQL Database",
    "type": "mysql",
    "is_active": true,
    "config": {
      "host": "mysql",
      "port": 3306,
      "database": "mydb",
      "username": "myuser",
      "password": "mypassword"
    }
  }]
}
EOF

curl -s -X POST http://your-df-host/api/v2/system/service \
  -H "Content-Type: application/json" \
  -H "X-DreamFactory-API-Key: $APIKEY" \
  -H "X-DreamFactory-Session-Token: $TOKEN" \
  -d @/tmp/mysql_svc.json&lt;/syntaxhighlight>
'''Real response:'''

&lt;syntaxhighlight lang="json">{"resource": [{"id": 12}]}&lt;/syntaxhighlight>
Returns just the new service ID. Use it for updates/deletes: &lt;code>PATCH /api/v2/system/service/12&lt;/code>.

&lt;span id="create-a-postgresql-service">&lt;/span>
=== Create a PostgreSQL Service ===

&lt;syntaxhighlight lang="bash">cat > /tmp/pgsql_svc.json &lt;&lt; 'EOF'
{
  "resource": [{
    "name": "world",
    "label": "World (Sample Data)",
    "type": "pgsql",
    "is_active": true,
    "config": {
      "host": "example_data",
      "port": 5432,
      "database": "world",
      "username": "postgres",
      "password": "root_pw"
    }
  }]
}
EOF

curl -s -X POST http://your-df-host/api/v2/system/service \
  -H "Content-Type: application/json" \
  -H "X-DreamFactory-API-Key: $APIKEY" \
  -H "X-DreamFactory-Session-Token: $TOKEN" \
  -d @/tmp/pgsql_svc.json&lt;/syntaxhighlight>
&lt;span id="delete-a-service">&lt;/span>
=== Delete a Service ===

&lt;syntaxhighlight lang="bash">curl -s -X DELETE "http://your-df-host/api/v2/system/service?ids=12" \
  -H "X-DreamFactory-API-Key: $APIKEY" \
  -H "X-DreamFactory-Session-Token: $TOKEN"&lt;/syntaxhighlight>

-----

&lt;span id="app-management">&lt;/span>
== App Management ==

&lt;span id="list-apps-includes-api-keys">&lt;/span>
=== List Apps (includes API keys) ===

&lt;syntaxhighlight lang="bash">curl -s "http://your-df-host/api/v2/system/app?fields=id,name,api_key,is_active" \
  -H "X-DreamFactory-API-Key: $APIKEY" \
  -H "X-DreamFactory-Session-Token: $TOKEN"&lt;/syntaxhighlight>
'''Real response:'''

&lt;syntaxhighlight lang="json">{
  "resource": [
    {"id": 1, "name": "admin",        "api_key": "6498a8ad...", "is_active": true},
    {"id": 2, "name": "api_docs",     "api_key": "36fda24f...", "is_active": true},
    {"id": 3, "name": "file_manager", "api_key": "b5cb82af...", "is_active": true}
  ]
}&lt;/syntaxhighlight>
The &lt;code>admin&lt;/code> app's &lt;code>api_key&lt;/code> is the one to use for &lt;code>X-DreamFactory-API-Key&lt;/code> in admin operations.

-----

&lt;span id="api-discovery">&lt;/span>
== API Discovery ==

&lt;span id="get-openapi-spec-for-a-service-df-7.4.x">&lt;/span>
=== Get OpenAPI Spec for a Service (DF 7.4.x) ===

&lt;syntaxhighlight lang="bash">curl -s http://your-df-host/api/v2/api_docs/world \
  -H "X-DreamFactory-API-Key: $APIKEY" \
  -H "X-DreamFactory-Session-Token: $TOKEN"&lt;/syntaxhighlight>
Returns a full OpenAPI 3.0 spec. The &lt;code>world&lt;/code> service has 14 paths covering &lt;code>_schema&lt;/code> and &lt;code>_table&lt;/code> operations.

First 5 paths:

&lt;syntaxhighlight lang="text">
GET/POST/PUT/PATCH  /_schema
GET/POST/PUT/PATCH/DELETE  /_schema/{table_name}
GET/POST/PUT/PATCH/DELETE  /_schema/{table_name}/_field
GET  /_schema/{table_name}/_related
GET/POST/PUT/PATCH/DELETE  /_table/{table_name}
&lt;/syntaxhighlight>
&lt;span id="get-spec-for-system-api">&lt;/span>
=== Get Spec for System API ===

&lt;syntaxhighlight lang="bash">curl -s http://your-df-host/api/v2/api_docs/system \
  -H "X-DreamFactory-API-Key: $APIKEY" \
  -H "X-DreamFactory-Session-Token: $TOKEN"&lt;/syntaxhighlight>
Returns 32 paths covering all system management operations.

-----

&lt;span id="data-queries">&lt;/span>
== Data Queries ==

All examples use the &lt;code>world&lt;/code> PostgreSQL service (3 tables: &lt;code>country&lt;/code>, &lt;code>city&lt;/code>, &lt;code>countrylanguage&lt;/code>).

&lt;span id="list-tables">&lt;/span>
=== List Tables ===

&lt;syntaxhighlight lang="bash">curl -s "http://your-df-host/api/v2/world/_schema?fields=name" \
  -H "X-DreamFactory-API-Key: $APIKEY" \
  -H "X-DreamFactory-Session-Token: $TOKEN"&lt;/syntaxhighlight>
'''Real response:'''

&lt;syntaxhighlight lang="json">{
  "resource": [
    {"name": "city"},
    {"name": "country"},
    {"name": "countrylanguage"}
  ]
}&lt;/syntaxhighlight>
&lt;span id="basic-query-with-field-selection">&lt;/span>
=== Basic Query with Field Selection ===

&lt;syntaxhighlight lang="bash">curl -s "http://your-df-host/api/v2/world/_table/country?limit=3&amp;fields=Code,Name,Continent,Population" \
  -H "X-DreamFactory-API-Key: $APIKEY" \
  -H "X-DreamFactory-Session-Token: $TOKEN"&lt;/syntaxhighlight>
'''Real response:'''

&lt;syntaxhighlight lang="json">{
  "resource": [
    {"code": "AFG", "name": "Afghanistan",          "continent": "Asia",          "population": 22720000},
    {"code": "NLD", "name": "Netherlands",           "continent": "Europe",        "population": 15864000},
    {"code": "ANT", "name": "Netherlands Antilles",  "continent": "North America", "population": 217000}
  ]
}&lt;/syntaxhighlight>
&lt;span id="filter-sort-limit">&lt;/span>
=== Filter + Sort + Limit ===

&lt;syntaxhighlight lang="bash">curl -s "http://your-df-host/api/v2/world/_table/country?filter=Continent%3D'Asia'&amp;order=Population%20DESC&amp;limit=5&amp;fields=Name,Continent,Population,LifeExpectancy" \
  -H "X-DreamFactory-API-Key: $APIKEY" \
  -H "X-DreamFactory-Session-Token: $TOKEN"&lt;/syntaxhighlight>
'''Real response:'''

&lt;syntaxhighlight lang="json">{
  "resource": [
    {"name": "China",       "continent": "Asia", "population": 1277558000, "lifeexpectancy": 71.4},
    {"name": "India",       "continent": "Asia", "population": 1013662000, "lifeexpectancy": 62.5},
    {"name": "Indonesia",   "continent": "Asia", "population": 212107000,  "lifeexpectancy": 68.0},
    {"name": "Pakistan",    "continent": "Asia", "population": 156483000,  "lifeexpectancy": 61.1},
    {"name": "Bangladesh",  "continent": "Asia", "population": 129155000,  "lifeexpectancy": 60.2}
  ]
}&lt;/syntaxhighlight>
Filter syntax: &lt;code>field=value&lt;/code>, &lt;code>field&amp;gt;value&lt;/code>, &lt;code>field LIKE '%pattern%'&lt;/code>, &lt;code>field IN (a,b,c)&lt;/code>. URL-encode special chars.

&lt;span id="get-single-record-by-id">&lt;/span>
=== Get Single Record by ID ===

&lt;syntaxhighlight lang="bash">curl -s "http://your-df-host/api/v2/world/_table/country/USA?fields=Name,Code,Continent,Population,LifeExpectancy" \
  -H "X-DreamFactory-API-Key: $APIKEY" \
  -H "X-DreamFactory-Session-Token: $TOKEN"&lt;/syntaxhighlight>
'''Real response:'''

&lt;syntaxhighlight lang="json">{
  "name": "United States",
  "code": "USA",
  "continent": "North America",
  "population": 278357000,
  "lifeexpectancy": 77.1
}&lt;/syntaxhighlight>
Single-record response is unwrapped (no &lt;code>resource&lt;/code> array).

&lt;span id="create-a-record">&lt;/span>
=== Create a Record ===

&lt;syntaxhighlight lang="bash">cat > /tmp/new_record.json &lt;&lt; 'EOF'
{
  "resource": [{
    "name": "John Doe",
    "email": "john@example.com"
  }]
}
EOF

curl -s -X POST http://your-df-host/api/v2/myservice/_table/contacts \
  -H "Content-Type: application/json" \
  -H "X-DreamFactory-API-Key: $APIKEY" \
  -H "X-DreamFactory-Session-Token: $TOKEN" \
  -d @/tmp/new_record.json&lt;/syntaxhighlight>
'''Response:''' &lt;code>{&amp;quot;resource&amp;quot;: [{&amp;quot;id&amp;quot;: 42}]}&lt;/code> — returns the new record's primary key.

&lt;span id="update-a-record">&lt;/span>
=== Update a Record ===

&lt;syntaxhighlight lang="bash">cat > /tmp/update.json &lt;&lt; 'EOF'
{"email": "john.updated@example.com"}
EOF

curl -s -X PATCH http://your-df-host/api/v2/myservice/_table/contacts/42 \
  -H "Content-Type: application/json" \
  -H "X-DreamFactory-API-Key: $APIKEY" \
  -H "X-DreamFactory-Session-Token: $TOKEN" \
  -d @/tmp/update.json&lt;/syntaxhighlight>
&lt;span id="delete-records">&lt;/span>
=== Delete Records ===

&lt;syntaxhighlight lang="bash"># By ID
curl -s -X DELETE "http://your-df-host/api/v2/myservice/_table/contacts?ids=1,2,3" \
  -H "X-DreamFactory-API-Key: $APIKEY" \
  -H "X-DreamFactory-Session-Token: $TOKEN"

# By filter
curl -s -X DELETE "http://your-df-host/api/v2/myservice/_table/contacts?filter=status%3D'inactive'" \
  -H "X-DreamFactory-API-Key: $APIKEY" \
  -H "X-DreamFactory-Session-Token: $TOKEN"&lt;/syntaxhighlight>

-----

&lt;span id="query-parameter-reference">&lt;/span>
== Query Parameter Reference ==

{| class="wikitable"
|-
! Param
! Example
! Description
|-
| &lt;code>fields&lt;/code>
| &lt;code>fields=id,name,email&lt;/code>
| Return only these fields. &lt;code>*&lt;/code> = all.
|-
| &lt;code>filter&lt;/code>
| &lt;code>filter=status='active'&lt;/code>
| SQL-like filter. URL-encode &lt;code>=&lt;/code>, spaces, quotes.
|-
| &lt;code>order&lt;/code>
| &lt;code>order=name ASC&lt;/code>
| Sort field + direction. URL-encode space.
|-
| &lt;code>limit&lt;/code>
| &lt;code>limit=25&lt;/code>
| Max records. Default varies by config.
|-
| &lt;code>offset&lt;/code>
| &lt;code>offset=50&lt;/code>
| Skip N records (for pagination).
|-
| &lt;code>include_count&lt;/code>
| &lt;code>include_count=true&lt;/code>
| Add &lt;code>meta.count&lt;/code> with total matching records.
|-
| &lt;code>related&lt;/code>
| &lt;code>related=city_by_CountryCode&lt;/code>
| Join related table. Name format: &lt;code>{table}_by_{fk_field}&lt;/code>.
|-
| &lt;code>ids&lt;/code>
| &lt;code>ids=1,2,3&lt;/code>
| Fetch specific records by primary key.
|}

-----

&lt;span id="notes-for-llms">&lt;/span>
== Notes for LLMs ==

# '''Always use &lt;code>-d @file.json&lt;/code>''' for POST/PATCH bodies. Inline &lt;code>-d '...'&lt;/code> has shell quoting edge cases that silently drop the body.
# '''Token expires in 24h.''' Re-POST to &lt;code>/api/v2/system/admin/session&lt;/code> to refresh.
# '''Field names are lowercased''' in responses even if the DB uses uppercase (e.g., &lt;code>Code&lt;/code> → &lt;code>code&lt;/code>).
# '''Single vs list responses:''' By-ID requests return the object directly. List requests return &lt;code>{&amp;quot;resource&amp;quot;: [...]}&lt;/code>.
# '''Check the live spec first:''' &lt;code>GET /api/v2/api_docs/{service_name}&lt;/code> gives you the exact schema for any service before you start querying.

[[Category:Curl_Examples]]
[[Category:Live_Api]]
[[Category:Dreamfactory_Examples]]
[[Category:API]]

[[Category:API]]
Return to [System Api Examples](/System_Api_Examples).

Retrieved from "[https://wiki.dreamfactory.com/System_Api_Examples](https://wiki.dreamfactory.com/System_Api_Examples)"