Objectivity REST : Schema Resources : POST /v1/schema
POST /v1/schema
POST /v1/schema
Adds one or more new class descriptions to the schema of a federated database.
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 class.
isReferenceable
Specifies whether the new class is persistence capable. 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.
superClass
Specifies a superclass for the new class.
attributes
Names and defines each attribute of the new class; see Objectivity/DB Data Types for information about supported attribute types, their encodings, storage, and so forth.
attributeName provides the name for the new attribute.
logicalType specifies the class type for the 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 that are to belong to 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 can use this resource to add new classes when designing or expanding the schema for an application. You provide one or more class descriptions in a JSON array.
If specifying a superclass for the 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).
See Objectivity/DB Data Types for information about supported attribute types, their encodings, storage, and so forth.
Sample Body 
The following adds a (simplified) class description for Customer objects from the rental fleet  example. The JSON array defines a single Customer class that is referenceable. The class has several string attributes.
[
  {
    "className":"FleetData.Customer",
    "isReferenceable":true,
    "superClass":null,
    "attributes":[
      {
        "attributeName":"rewardPoints",
        "logicalType":"integer",
        "encoding":"unsigned",
        "storage":"b32"
      },
      {
        "attributeName":"firstName",
        "logicalType":"string",
        "encoding":"utf8",
        "storage":"variable"
      },
      {
        "attributeName":"lastName",
        "logicalType":"string",
        "encoding":"utf8",
        "storage":"variable"
      }
    ]
  }
]
Curl Example 
For more complex bodies such as schema, you can provide the content in a file and submit it as follows:
curl -X POST -H "Content-Type:application/json,Accept:application/json" -d @mySchema.txt localhost:8185/v1/schema
Response 
The response provides an array of shape number(s) and URI(s) for the new classes.
Status: 201 Created
{
  "classNumbers": [
    "1000014"
  ],
  "uris": [
    "/v1/schema/1000014"
  ]
}
More Samples 
The following provides the class description for the RentalContract class. This class has several types of attributes, including reference, integer, and list attributes.
[
  {
    "className": "FleetData.RentalContract",
    "isReferenceable": true,
    "superClass": null,
    "attributes": [
      {
        "attributeName": "customer",
        "logicalType": "reference",
        "referencedClass": "FleetData.Customer",
        "inverseAttribute": "rentals"
      },
      {
        "attributeName": "vehicle",
        "logicalType": "reference",
        "referencedClass": "FleetData.Vehicle",
        "inverseAttribute": "pastRentals"
      },
      {
        "attributeName": "trackingNumber",
        "logicalType": "integer",
        "encoding": "signed",
        "storage": "b16"
      },
      {
        "attributeName": "events",
        "logicalType": "list",
        "storage": "variable",
        "elementSpecification": {
          "logicalType": "reference",
          "referencedClass": "FleetData.RentalEvent"
        }
      }
    ]
  }
]
See also 
PUT /v1/schema to modify one or more classes
PUT /v1/schema/{class} to modify a single class
Objectivity/DB Data Types for descriptions and examples of all attribute types