Posting data to multiple tables with joins

From DreamFactory
Jump to: navigation, search
DreamFactoryTutorialsPosting data to multiple tables with joins
(Created page with "[http://www.youtube.com/watch?v=utN70VC2X-Y youtube.com]<br><br><br><br>Brett has constantly had a residence in Mississippi, and also he presently lives there with his partner...")
 
 
(9 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[http://www.youtube.com/watch?v=utN70VC2X-Y youtube.com]<br><br><br><br>Brett has constantly had a residence in Mississippi, and also he presently lives there with his partner Deanna. They have two daughters, Brittany and Breleigh. Brett has released publications, owns a steakhouse, made an appearance in "There's Something concerning Mary", and also started the Brett Favre Fourward Structure. The foundation raises money for youngsters in Mississippi and Wisconsin.<br><br>Reyes was motivated to give his best by team friends David Wright and also Ryan Howard. When the house run was attacked, the Japanese followers appeared into cheers, shouting Jose's name. Reyes said that when he heard his name being shouted, he really felt that he was playing in Shea Stadium.<br><br>With this in thoughts, right here are 8 key Dos as well as do n'ts for automobile crash targets. Can aid these suggestions, you ought to do to be associated with an auto mishap as well as might be used for employing an auto [http://calders-apparel.tumblr.com accident attorney reading pa] think.<br><br>Kale Brecht (Shia LeBeouf) loses his dad in a car accident as well as a year later, assault his teacher after discussing his dad. He is placed under property apprehension then witnesses just what he thinks is a murder. He scrounges around, trying to find any proof of the murder. Also at the threat of his ankle joint bracelet going off. Kale really wants to confirm he is telling the reality in the worst means. Yet completing such an activity may get him in even more trouble compared to he ever bargained for. He additionally needs to bear with his educator's cousin, that is the officer assigned to him.<br><br>ESPN is stating that Iverson as well as the Philadelphia 76'ers are in discussions of whether Iverson's go back to Philadelphia is a probability. Iverson has actually stated that he constantly wanted to finish his career with the Philadephia 76'ers. The city of Philadephia not simply approved Iverson throughout his time there, but likewise worshipped him. Iverson brought them right into the playoffs year after year as well as lugged them to the NBA Finals in one wonderful period. In Philadelphia, that acquired him love. Regrettably for Iverson, the love hasn't spread out across other NBA cities.<br><br>American star Billy Zane (Back to the Future, Back to the Future Component II, Critters, Dead Calm, Memphis Belle, Only You, Orlando, The Phantom, Titanic and also Twin Peaks) was born upon February 24, 1966.<br><br>Lidge's total performance throughout the normal period and also playoffs played a vital function in the Phillies victorying the 2008 Globe Series. In postseason action, he converted a perfect seven from 7 in save opportunities and saved the decisive Game 5 of the World Collection by starting out Tampa Bay's Eric Hinske to clinch the champion.
+
POST records to multiple SQL tables related by foreign key. Try these examples in the 'API Docs' tab of the DreamFactory Admin Console or from the command line with cURL.
 +
 
 +
'''Note''' When using a 'Many to Many' relationship to POST you must use an array for the related data.
 +
 
 +
Note that this example also applies to updating records.
 +
 
 +
=== API Endpoint ===
 +
 
 +
<pre>POST https://{url}/api/v2/{api_name}/_table/{table_name}</pre>
 +
 
 +
=== API Docs Screenshot ===
 +
 
 +
[[File:Swagger-post-related-records.png|1000px]]
 +
 
 +
=== Example - POST contact records (parent table) and contact_info_by_contact_id records (child table) ===
 +
 
 +
* Table name: contact
 +
* Body parameter in API call:
 +
<pre>
 +
{
 +
"resource": [
 +
  {
 +
    "first_name": "Alice",
 +
    "last_name": "Jones",
 +
    "contact_info_by_contact_id": [
 +
        {
 +
          "info_type": "home",
 +
          "phone": "701-555-5555",
 +
          "email": "[email protected].com",
 +
          "address": "3761 N. 14th St",
 +
          "city": "MEDINA",
 +
          "state": "ND",
 +
          "zip": "58467",
 +
          "country": "USA"
 +
        },
 +
        {
 +
          "info_type": "work",
 +
          "phone": "701-555-5556",
 +
          "email": "[email protected].com",
 +
          "address": "2243 W St.",
 +
          "city": "MEDINA",
 +
          "state": "ND",
 +
          "zip": "58467",
 +
          "country": "USA"
 +
        }
 +
    ]
 +
  },
 +
  {
 +
    "first_name": "Bob",
 +
    "last_name": "Simpson",
 +
    "contact_info_by_contact_id": [
 +
        {
 +
          "info_type": "home",
 +
          "phone": "701-555-0162",
 +
          "email": "[email protected].com",
 +
          "address": "3762 N. 14th St",
 +
          "city": "MEDINA",
 +
          "state": "ND",
 +
          "zip": "58467",
 +
          "country": "USA"
 +
        },
 +
        {
 +
          "info_type": "work",
 +
          "phone": "701-555-0110",
 +
          "email": "[email protected]",
 +
          "address": "2244 W St.",
 +
          "city": "MEDINA",
 +
          "state": "ND",
 +
          "zip": "58467",
 +
          "country": "USA"
 +
        }
 +
    ]
 +
  }
 +
]
 +
} </pre>
 +
* Request URL: <pre>https://foo.com/api/v2/db/_table/contact</pre>

Latest revision as of 19:49, 9 October 2019

POST records to multiple SQL tables related by foreign key. Try these examples in the 'API Docs' tab of the DreamFactory Admin Console or from the command line with cURL.

Note When using a 'Many to Many' relationship to POST you must use an array for the related data.

Note that this example also applies to updating records.

API Endpoint

POST https://{url}/api/v2/{api_name}/_table/{table_name}

API Docs Screenshot

Swagger-post-related-records.png

Example - POST contact records (parent table) and contact_info_by_contact_id records (child table)

  • Table name: contact
  • Body parameter in API call:
{
 "resource": [
   {
     "first_name": "Alice",
     "last_name": "Jones",
     "contact_info_by_contact_id": [
        {
          "info_type": "home",
          "phone": "701-555-5555",
          "email": "[email protected]",
          "address": "3761 N. 14th St",
          "city": "MEDINA",
          "state": "ND",
          "zip": "58467",
          "country": "USA"
        },
        {
          "info_type": "work",
          "phone": "701-555-5556",
          "email": "[email protected]",
          "address": "2243 W St.",
          "city": "MEDINA",
          "state": "ND",
          "zip": "58467",
          "country": "USA"
        }
    ]
   },
   {
     "first_name": "Bob",
     "last_name": "Simpson",
     "contact_info_by_contact_id": [
        {
          "info_type": "home",
          "phone": "701-555-0162",
          "email": "[email protected]",
          "address": "3762 N. 14th St",
          "city": "MEDINA",
          "state": "ND",
          "zip": "58467",
          "country": "USA"
        },
        {
          "info_type": "work",
          "phone": "701-555-0110",
          "email": "[email protected]",
          "address": "2244 W St.",
          "city": "MEDINA",
          "state": "ND",
          "zip": "58467",
          "country": "USA"
        }
    ]
   }
 ]
} 
  • Request URL:
    https://foo.com/api/v2/db/_table/contact