Querying multiple tables with joins

From DreamFactory
Jump to: navigation, search
DreamFactoryTutorialsQuerying multiple tables with joins
(Created page with "Understanding the specific health, diet and exercise regimen. When plumbing business software I'm buying trays of plants and I'll bring them home. This week, I'm looking more...")
 
(Created page with "### Tutorial Query a SQL database for records in different tables joined by key. Try these examples in the 'API Docs' tab of the DreamFactory Admin Console or from the comman...")
Line 1: Line 1:
Understanding the specific health, diet and exercise regimen. When plumbing business software I'm buying trays of plants and I'll bring them home. This week, I'm looking more specifically at what this means for health risk. And yes, plumbing business software it can be very fulfilling and rewarding if not rushed. Behaving diligently all of the expensive changes, narrower networks, higher deductibles, and fewer choices if the uninsured largely don't want it? It allows for some differentiation.<br><br>Visit my weblog: [https://www.youtube.com/watch?v=QSUjSLVIwT4 24 hour emergency plumber london]
+
### Tutorial
 +
 
 +
Query a SQL database for records in different tables joined by key. Try these examples in the 'API Docs' tab of the DreamFactory Admin Console or from the command line with cURL.
 +
 
 +
Note that passing * as the 'related' parameter will return all records by foreign key.
 +
 
 +
### API Endpoint
 +
 
 +
<pre>GET https://{url}/api/v2/{api_name}/_table/{table_name}?related={foreign_key_field}</pre>
 +
 
 +
### API Docs Screenshot
 +
 
 +
[[File:Swagger-filter.png|1000px]]
 +
 
 +
### Example - Fetch contact and contact_info_by_contact_id records in one API call. Each contact has zero or more contact_info_by_contact_id records.
 +
 
 +
* Table name: contact
 +
* Related parameter in API call: <pre>related=contact_info_by_contact_id</pre>
 +
* Request URL: <pre>https://foo.com/api/v2/db/_table/contact?related=contact_info_by_contact_id</pre>
 +
 
 +
### Example - Fetch  contact and all related records by foreign key in one API call.
 +
 
 +
* Table name: contact
 +
* Filter parameter in API call: <pre>related=*</pre>
 +
* Request URL: <pre>https://foo.com/api/v2/db/_table/contact?related=*</pre>

Revision as of 16:57, 9 October 2015

      1. Tutorial

Query a SQL database for records in different tables joined by key. Try these examples in the 'API Docs' tab of the DreamFactory Admin Console or from the command line with cURL.

Note that passing * as the 'related' parameter will return all records by foreign key.

      1. API Endpoint
GET https://{url}/api/v2/{api_name}/_table/{table_name}?related={foreign_key_field}
      1. API Docs Screenshot

Swagger-filter.png

      1. Example - Fetch contact and contact_info_by_contact_id records in one API call. Each contact has zero or more contact_info_by_contact_id records.
  • Table name: contact
  • Related parameter in API call:
    related=contact_info_by_contact_id
  • Request URL:
    https://foo.com/api/v2/db/_table/contact?related=contact_info_by_contact_id
      1. Example - Fetch contact and all related records by foreign key in one API call.
  • Table name: contact
  • Filter parameter in API call:
    related=*
  • Request URL:
    https://foo.com/api/v2/db/_table/contact?related=*