Objectivity REST : Object Resources : POST /v1/object
POST /v1/object
POST /v1/object
Adds a new object to a federated database and assigns an OID.
Headers 
 
Response Format
Accept:application/json
Body format
Content-Type:application/json
URL Parameters 
fdAlias
Provides the alias of a federated database that is included in the REST server’s configuration file; see Configuring the REST Server in Objectivity/DB Administration.
Body Parameters 
class
Fully qualified class name or class number of the object’s type.
attributes
Provides the names and values (and other information) for attributes of basic types, string types, date-time types, references and embedded types, as well as list, set, and map types.
elements
Designates the entries for a list or set attribute.
pairs
Designates the key-value pairs for a map attribute.
Discussion 
You use this resource to add a new object based on a class description in the schema. If you do not provide values for attributes, default values are assigned (null OIDs for reference attributes, false for Boolean attributes, empty arrays for lists, and so forth); see “Objectivity/DB Data Types” for more information.
Values for attributes can be updated or provided at a later time using PUT /v1/object/{oid}.
Sample Body 
The following body creates a Vehicle object for the rental fleet example. The value of "TLA8423" is supplied for the license string attribute.
{ 
  "class": "FleetData.Vehicle",
  "attributes":
    { 
      "license": "TLA8423"
    }
}
Curl Example 
curl -X POST -H "Content-Type:application/json,Accept:application/json" -d "{\"class\":\"FleetData.Vehicle\",\"attributes\":{\"license\":\"TLA8423\"}}" localhost:8185/v1/object
Response 
The response includes the OID for the new object and its URI.
Status: 201 Created
{
  "__identifier__": "3-3-1-12",
  "uri": "/v1/object/3-3-1-12"
}
More Samples 
The following body creates a Vehicle object that references a RentalContract object. The OID for the RentalContract object is provided as the value for the currentRental reference attribute:
{ 
  "class": "FleetData.Vehicle",
  "attributes":
    { 
      "license": "ABC1997",
      "currentRental": "3-3-1-8"
    }
}
The following body creates a Vehicle object that has a list of references to RentalContract objects. Multiple OIDs are provided as the elements of the pastRental list attribute:
{ 
  "class": "FleetData.Vehicle",
  "attributes":
    { 
      "license": "XEG9903",
      "currentRental": "3-3-1-18",
      "pastRentals": 
        {
          "elements": [
            "3-3-1-19",
            "3-3-1-20",
            "3-3-1-21"
          ]
        }
    }
}
The following body creates a RentalCompany object with a name map attribute where the key is the userId of a Customer (as assigned by the application) and the object is a reference to that Customer (via the OID assigned by the federated database):
{
  "class": "FleetData.RentalCompany",
  "attributes": 
    {
      "customers": {
        "pairs": {
          "009": "3-3-1-5"
        }
      }
    }
}
See also 
PUT /v1/object/{oid} to modify an existing object
GET /v1/object/{oid} to get an object by its OID
DELETE /v1/object/{oid} to delete an existing object by its OID