Posting a single record

From DreamFactory
Jump to: navigation, search
DreamFactoryTutorialsPosting a single record
(Created page with "### Tutorial POST a single record by ID to a SQL or NoSQL database. Try these examples in the 'API Docs' tab of the DreamFactory Admin Console or from the command line with c...")
Line 5: Line 5:
 
### API Endpoint
 
### API Endpoint
  
<pre>POST https://{url}/api/v2/{api_name}/_table/{table_name}</pre>
+
<pre>POST https://{url}/api/v2/{api_name}/_table/{table_name}/{id}</pre>
  
 
### API Docs Screenshot
 
### API Docs Screenshot
  
[[File:Swagger-post-records.png|1000px]]
+
[[File:Swagger-post-record.png|1000px]]
  
### Example - Post multiple contact records
+
### Example - Post a single contact record
  
 
* Table name: contact
 
* Table name: contact
Line 19: Line 19:
 
     "first_name": "Alice",
 
     "first_name": "Alice",
 
     "last_name": "Jones"
 
     "last_name": "Jones"
  },
 
  {
 
    "first_name": "Bob",
 
    "last_name": "Simpson"
 
 
   }
 
   }
 
  ]
 
  ]
 
}</pre>
 
}</pre>
* Request URL: <pre>https://foo.com/api/v2/db/_table/contact</pre>
+
* Request URL: <pre>https://foo.com/api/v2/db/_table/contact/1</pre>

Revision as of 18:41, 13 October 2015

      1. Tutorial

POST a single record by ID to a SQL or NoSQL database. Try these examples in the 'API Docs' tab of the DreamFactory Admin Console or from the command line with cURL.

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

Swagger-post-record.png

      1. Example - Post a single contact record
  • Table name: contact
  • Body parameter in API call:
    {
"resource": [ { "first_name": "Alice", "last_name": "Jones" } ] }
  • Request URL:
    https://foo.com/api/v2/db/_table/contact/1