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...")
m (Changed from markdown to mediawiki formatting)
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
### Tutorial
+
== 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.
 
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.
  
### 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 with ID 106 ===
  
 
* Table name: contact
 
* Table name: contact
* Body parameter in API call: <pre>{
+
* ID parameter is API call:
"resource": [
+
<pre>106</pre>
  {
+
* Body parameter in API call:  
    "first_name": "Alice",
+
<source lang="JavaScript">
    "last_name": "Jones"
+
{
  },
+
    "resource": [
  {
+
        {
    "first_name": "Bob",
+
            "first_name": "Alice",
    "last_name": "Simpson"
+
            "last_name": "Jones"
  }
+
        }
]
+
    ]
}</pre>
+
}
* Request URL: <pre>https://foo.com/api/v2/db/_table/contact</pre>
+
</source>
 +
* Request URL:  
 +
<pre>https://foo.com/api/v2/db/_table/contact/1</pre>

Latest revision as of 22:58, 5 May 2016

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.

API Endpoint

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

API Docs Screenshot

Swagger-post-record.png

Example - POST a single contact record with ID 106

  • Table name: contact
  • ID parameter is API call:
106
  • Body parameter in API call:
{
    "resource": [
        {
            "first_name": "Alice",
            "last_name": "Jones"
        }
    ]
}
  • Request URL:
https://foo.com/api/v2/db/_table/contact/1