Access Using API Key

From DreamFactory
Jump to: navigation, search
DreamFactoryTutorialsAccess Using API Key
 
(8 intermediate revisions by one other user not shown)
Line 1: Line 1:
DreamFactory 2.0 APIs can be consumed with just an API Key. The access is limited by the default role assigned to the  
+
DreamFactory APIs can be consumed with just an API key. Each app has a unique API key that is sent with each request. When no session token is provided, the request is considered to be from an unauthenticated user and the system uses the API key to look up the default role for the app. The default role for the app specifies what resources unauthenticated users have access to.  
application of the API key that is being used.
+
  
=== API Endpoints ===
+
Request:
  
<pre>{Method} https://{url}/api/v2/{service}/{resource}?api_key={api-key}</pre>
+
<pre>GET https://foo.com/api/v2/db/_table?api_key=abc123efg</pre>
 +
* HTTP method: GET
 +
* URL: https://foo.com/api/v2
 +
* Service: db
 +
* Resource: _table
 +
* API key: abc123efg
  
-- OR --
+
If passing multiple parameters, such as filter or limit:
  
<pre>{Method} https://{url}/api/v2/{service}/{resource}</pre>
+
<pre>GET https://foo.com/api/v2/db/_table?limit=1&api_key=abc123efg</pre>
Request header
+
* HTTP method: GET
<pre>
+
* URL: https://foo.com/api/v2
...
+
* Service: db
X-DreamFactory-Api-Key: {api_key}
+
* Resource: _table
...
+
*Additional Parameter: limit
</pre>
+
* API key: abc123efg
  
=== Example - Using URL parameter ===
+
'''Note:''' API key can also be supplied using the X-DreamFactory-Api-Key request header.
 
+
<pre>GET https://foo.com/api/v2/system/user?api_key=abc123efg</pre>
+
* Service: system
+
* Resource: user
+
* API Key: abc123efg
+
* Method: GET
+
* Request URL:
+
 
+
 
+
=== Example - Using request header ===
+
 
+
<pre>
+
...
+
X-DreamFactory-Api-Key: abc123efg
+
...
+
</pre>
+
 
+
Request URL:
+
<pre>GET https://foo.com/api/v2/system/user</pre>
+
 
+
* Service: system
+
* Resource: user
+
* API Key: abc123efg
+
* Method: GET
+
* Request Header:
+

Latest revision as of 18:15, 13 July 2018

DreamFactory APIs can be consumed with just an API key. Each app has a unique API key that is sent with each request. When no session token is provided, the request is considered to be from an unauthenticated user and the system uses the API key to look up the default role for the app. The default role for the app specifies what resources unauthenticated users have access to.

Request:

GET https://foo.com/api/v2/db/_table?api_key=abc123efg

If passing multiple parameters, such as filter or limit:

GET https://foo.com/api/v2/db/_table?limit=1&api_key=abc123efg
  • HTTP method: GET
  • URL: https://foo.com/api/v2
  • Service: db
  • Resource: _table
  • Additional Parameter: limit
  • API key: abc123efg

Note: API key can also be supplied using the X-DreamFactory-Api-Key request header.