create
Purpose
Creates a new record using data from an XML document. This method can be used to create a single record or a single record and related records.
create2
HTTP Method
POST
URL
https://app.infiniteblue.com/rest/api/createURL Parameters
sessionId
The session ID obtained from the body of the response when calling login.
objName
The object integration name.
requestBody
XML document containing object name, "useIds" attribute(true
or
false
- same meaning as in Web API), and Fields for the new record
(see example below).
output
Optional parameter specifying the output format, one of:
Permissions Required
Create permission for the requested object type.
Response
The ID and integration name of the new record and a status of
ok
(see examples below).
Example
Create input example:
<?xml version="1.0" encoding="utf-8" ?> <data objName="person" useIds="false"> <Field name="club_member">false</Field> <Field name="lastName">Smith</Field> <Field name="status">Created</Field> </data>
Create output example (XML):
<resp status="ok"> <data id="314452" objName="person" /> <Msg>12 fields have been processed.</Msg> </resp>
Create output example (JSON):
{ id: 314452 objName: "person" status: "ok" }
To create related objects in the same call, include a "composite" XML node which wraps a set of "data" XML nodes as described above. A new record is created for each "data" XML node. These new nodes have relationships with with core record. Consider this example with dependent nodes:
<?xml version="1.0" encoding="utf-8" ?> <data objName="person" useIds="false"> <Field name="club_member">false</Field> <Field name="lastName">Smith</Field> <Field name="status">Created</Field> <composite> <data objName="payment" useIds="false"> <Field name="amount">500.00</Field> <Field name="paym_date">09/12/2011</Field> </data> <data objName="payment" useIds="false"> <Field name="amount">450.00</Field> <Field name="paym_date">09/22/2011</Field> </data> </composite> </data>
This XML creates one "person" record and two related "payment" records in one call. Output example:
<resp status="ok"> <data id="314452" objName="person" /> <Msg>12 fields have been processed. 2 related records have been created.</Msg> </resp>