Method POST
Path /res/{resName}/{resId}
Query Params None
Request body One or more child rows to insert for parent identified in path Request.xsd Content-Type: application/xml or application/json
Response body Number of rows inserted and their values. Includes any auto-generated numeric ids from columns with auto-increment/sequence defined as default value. Response.xsd Content-Type: application/xml or application/json

Description

Creates one or more children rows for parent matching path parameters for a one-to-many hierarchical SQL Resource. Associates one or more children rows to parent matching path parameters for a many-to-many hierarchical SQL Resource.

XML Examples

A one-to-many hierarchical SQL resource (child rows are created):
POST /restsql/res/LanguageFilm/456 HTTP/1.1
Content-Type: application/xml

<request>
   <film film_id="42" title="ADAPTATION HOLES" year="2006" />
   <film film_id="43" title="ATLANTIS CAUSE" year="2006" />
   <film film_id="44" title="BERETS AGENT" year="2006" />
</request>
HTTP/1.1 200 OK
Content-Type: application/xml

<writeResponse rowsAffected="3">
   <language language_id="456">
      <film film_id="42" title="ADAPTATION HOLES" year="2006" />
      <film film_id="43" title="ATLANTIS CAUSE" year="2006" />
      <film film_id="44" title="BERETS AGENT" year="2006" />
   </language>
</writeResponse>

Following is the same request minus the pk values. The autogenerated values are returned in the response.

POST /restsql/res/LanguageFilm/456 HTTP/1.1
Content-Type: application/xml

<request>
   <film title="ADAPTATION HOLES" year="2006" />
   <film title="ATLANTIS CAUSE" year="2006" />
   <film title="BERETS AGENT" year="2006" />
</request>
HTTP/1.1 200 OK
Content-Type: application/xml

<writeResponse rowsAffected="3">
   <language language_id="456">
      <film film_id="42" title="ADAPTATION HOLES" year="2006" />
      <film film_id="43" title="ATLANTIS CAUSE" year="2006" />
      <film film_id="44" title="BERETS AGENT" year="2006" />
   </language>
</writeResponse>
A many-to-many hierarchical SQL resource (child rows are only associated to parent):
POST /restsql/res/ActorFilm/123 HTTP/1.1
Content-Type: application/xml

<request>
   <film film_id="3" />
   <film film_id="43" />
   <film film_id="67" />
</request>
HTTP/1.1 200 OK
Content-Type: application/xml

<writeResponse rowsAffected="3">
   <actor actor_id="123">
      <film film_id="3" />
      <film film_id="43" />
      <film film_id="67" />
   </actor>
</writeResponse>

JSON Examples

A one-to-many hierarchical SQL resource (child rows are created):
POST /restsql/res/LanguageFilm/456 HTTP/1.1
Content-Type: application/json
Accept: application/json

{ "films": [
      { "film_id": 81, "title": "ADAPTATION HOLES", "year": 2006 },
      { "film_id": 82, "title": "ATLANTIS CAUSE", "year": 2006 },
      { "film_id": 83, "title": "BERETS AGENT", "year": 2006 }
   ]
}
HTTP/1.1 200 OK
Content-Type: application/json

{ "rowsAffected": 3,
   "languages": [
      { "language_id": 456,
         "films": [
            { "film_id": 81, "title": "ADAPTATION HOLES", "year": 2006 },
            { "film_id": 82, "title": "ATLANTIS CAUSE", "year": 2006 },
            { "film_id": 83, "title": "BERETS AGENT", "year": 2006 }
         ]
      }
   ]
}
A many-to-many hierarchical SQL resource (child rows are only associated to parent):
POST /restsql/res/ActorFilm/123 HTTP/1.1
Content-Type: application/json
Accept: application/json

{ "films": [
      { "film_id": 42 },
      { "film_id": 43 },
      { "film_id": 44 },
   ]
}
HTTP/1.1 200 OK
Content-Type: application/xml

{ "rowsAffected": 3,
    "actors": [
      { "actor_id": 123,
         "films": [
            { "film_id": 42 },
            { "film_id": 43 },
            { "film_id": 44 },
         ]
      }
   ]
}