Objectivity REST : Schema Resources : PUT /v1/schema
PUT /v1/schema
PUT /v1/schema
Provides one or more class descriptions, each of which results in the creation of a new class or the addition of new attributes to an existing class.
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 
className
Specifies the fully qualified name for the new or existing class.
isReferenceable
Specifies whether objects of this class are persistence capable.
You should include isReferenceable if className specifies a new class. Setting isReferenceable to true causes the new class to be persistence capable, so its objects can be stored and found independently of other objects. Setting isReferenceable to false causes the new class to be embeddable, so its objects can be stored only when embedded in other objects. Objects of an embeddable schema class simply serve as composite data values. See Reference and Embedded Types for more information.
You can optionally omit isReferenceable if className specifies an existing class.
If className specifies an existing embeddable class, you can change it to be referenceable by including isReferenceable and setting it to true. Note, however, that an error is reported if the class you are trying to change is already being used as an embeddable attribute type in some other class.
superClass
Specifies a superclass for the class. If className specifies an existing class to be matched, then superClass must specify the class’s direct superclass, if it has one.
attributes
Names and defines one or more new attributes of the class; see Objectivity/DB Data Types for information about supported attribute types, their encodings, storage, and so forth.
attributeName provides the name for a new attribute.
logicalType specifies the class type for a new attribute.
encoding specifies the representation used for a value of the chosen type.
storage specifies the amount of storage specifically for the chosen type.
fixedLength specifies the length for fixed-length string attributes. This option is valid only when logicalType is string.
referencedClass is for an attribute that provides a reference to another class. This option is valid only when logicalType is reference.
inverseAttribute is for one of a pair of attributes that reference each other, creating bidirectional links between objects of the given classes; see Understanding Relationships. This option is valid only when logicalType is reference.
class specifies the fully qualified class name for an embeddable class attribute. This option is valid only when isReferenceable is false.
collectionTypeName provides the name of one of the built-in collection-implementation types available for federated databases. This option is valid only when logicalType is list, set, or map.
elementSpecification defines the elements of a list or set, or the values within a map’s key-value pairs. See Table 2‑5 for examples.
logicalType specifies the class type for elements.
referencedClass provides the class to be referenced when the logicalType is reference.
encoding specifies the representation for an element of the chosen type.
storage specifies the amount of storage specifically for the chosen type of element.
fixedLength specifies the length for fixed-length string elements.
keySpecification defines the keys within the key-value pairs of a map. See Table 2‑5 for examples.
 
Discussion 
You provide one or more class descriptions in a JSON array. If one of the classes already exists in the schema, that class is updated with the new attributes. Otherwise, a new class is created. Omitting an attribute for an existing class does not cause the attribute to be deleted.
Important: Modifying existing schema, or evolving it, has consequences for existing objects of a modified type. There can be loss of data depending on the type of change; see Schema Evolution.
This resource does not let you rename a class, or delete, rename, or change the type of existing attributes. For these operations, see PUT /v1/schema/{class}.
For matching an existing class for an update, the JSON body must include the fully qualified class name or class number, the namespace (if any), the super class (if any), and the attributes to add.
If specifying a superclass for a new class, provide either the fully qualified class name or the class number in double quotes. Similarly, when providing a reference attribute, use the fully qualified class name or the class number. The class number takes precedence if both are provided (in both scenarios).
Sample Body 
The following updates an existing Customer class that is part of the rental fleet example, adding a new goldStatus boolean attribute.
[
  {
    "className": "FleetData.Customer",
    "attributes": [
      {
        "attributeName": "goldStatus",
        "logicalType": "boolean",
        "encoding": "binary",
        "storage": "byte"
      }
    ]
  }
]
Curl Example 
For more complex bodies such as schema modifications, you can provide the content in a file and submit it as follows:
curl -X PUT -H "Content-Type:application/json,Accept:application/json" -d @mySchemaModsFile.txt localhost:8185/v1/schema
Response 
The response provides an array of class number(s) and URI(s) for the updated class(es).
 
Status: 201 Created
{
  "classNumbers": [
    "1000000"
  ],
  "uris": [
    "/v1/schema/1000000"
  ]
}
See also 
DELETE /v1/schema/{class} to delete a class
PUT /v1/schema/{class} to delete an attribute
PUT /v1/schema/{class} to change the type of an attribute
Objectivity/DB Data Types