Objectivity REST : Object Resources : PUT /v1/object/{oid}
PUT /v1/object/{oid}
PUT /v1/object/{oid}
Modifies an existing object by changing attribute values.
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 
attributes
Provides the names and values for attributes of basic types, string types, date-time types, reference and embedded types, as well as list, set, and map types.
action
Specifies the action to take when modifying a list, set, or map attribute:
add the provided elements to the list or set or use the provided key-value pair to update the map.

With maps, you can modify the value for an existing key or add a new key and provide its value. To modify the value of an existing key, simply provide the existing key with the new value. To create a new key-value pair, provide the new key with the new value and also set the exists parameter to ignore (see below).
override an existing list, set, or map with a completely new structure.
remove an existing value from a list, set, or map.
elements
Designates the entries for a list or set attribute.
pairs
Designates the key-value pairs for a map attribute. If a provided key already exists in the map, it’s value is overwritten. Otherwise, a new key-value pair is added.
Discussion 
You can modify an existing object by changing attribute values. In addition to the basic types, string types, date-time types, references and embedded types, you can modify the contents of list, map, or set attribute by adding or removing a value. You can also overwrite an existing list, map, or set with a new one (either populated or empty).
When performing PUT operations on existing objects, you should omit attributes that are to remain unchanged to avoid the overhead of overwriting a value with the same value.
Sample Body 
Given a Vehicle object with the license string attribute set to XLT5663, the following changes that value to LSX4559,
{ 
  "class": "FleetData.Vehicle",
  "attributes":
    { 
      "license": "LSX4559"
    }
}
Curl Example 
curl -X PUT -H "Content-Type:application/json,Accept:application/json" -d "{\"class\":\"FleetData.Vehicle\",\"attributes\":{\"license\":\"LSX4559\"}}" localhost:8185/v1/object/3-3-1-9
Response 
 
Status: 204 No Content
More Samples 
Given a Vehicle object, removes the RentalContract with the given OID from the list of past rentals. The RentalContract object is removed from the collection, not from the federated database.
{
  "attributes": 
    {
      "pastRentals": 
        {
          "action": "remove",
          "elements":
            [
              "3-3-1-21"
            ]
        }
    }
}
 
Given a RentalCompany object, adds two Vehicle objects to the set designated by the vehicles attribute.
{
  "attributes": 
    {
      "vehicles": 
        {
          "action": "add",
          "elements": ["3-3-1-9","3-3-1-12"]
        }
    }
}
Assume there is a RentalCompany object with a name map attribute called customers that maps userIds to Customer objects. The following replaces the Customer object with the userId key of 1077 in the map with the Customer object specified by the provided OID.
{
  "attributes": 
    {
      "customers": 
        {
          "action": "add",
          "pairs": 
            {
              "1077": "3-3-1-17"
            } 
        }
    }
}
The following removes the entire element (consisting of the key "1077" and the specified Customer) from the map. The Customer object is removed from the collection, not from the federated database.
{
  "attributes": 
    {
      "customers": 
        {
          "action": "remove",
          "pairs": 
            {
              "1077": "3-3-1-17"
            } 
        }
    }
}
The following example replaces the entire customers name map with a new empty map:
 
{
  "attributes": 
    {
      "customers": 
        {
          "action": "override",
          "pairs": {}
        }
    }
}
See also 
GET /v1/object/{oid} to get the object with the given identifier
DELETE /v1/object/{oid} to delete an existing object
POST /v1/object  to create an object