Posting data to multiple tables with joins

From DreamFactory
Jump to: navigation, search
DreamFactoryTutorialsPosting data to multiple tables with joins
      1. Tutorial

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 that this example also applies to updating records.

      1. API Endpoint
POST https://{url}/api/v2/{api_name}/_table/{table_name}
      1. API Docs Screenshot

Swagger-post-related-records.png

      1. Example - POST multiple contact records
  • 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