The following OData examples use the Web API v3 to create objects.
When creating an entity instance, the Class property is not required if the correct @odata.type property is supplied. Class can be inferred from this property, from the Edm Model. The exception to this is when an object is created in a deep insert against a navigation property that exposes an interface. In this case, the @odata.type must be the exposed interface, and the Class property must be supplied.
Create an object
Operator |
Description |
Example |
---|---|---|
Create an Object |
This example creates an SPFFolder object, assigning the Name, Description, and Class properties. |
POST . . /api/v3/ADW/SPFFolders Content-Type: application/json { "@odata.type": "#Intergraph.SPF.Server.API.Model.SPFFolder", "Name": "Folder-01-0010", "Description": "Folder-01-0010a", "Class": "SPFFolder" } |
Create and Deep Link One to One (1-1)
Operator |
Description |
Example |
---|---|---|
Create and Deep Link One to One (1-1) |
This example creates a DevelopmentTag object, assigning the Name and Description properties. The DevelopmentTag object then establishes a relationship to an existing SPFClassification object through the 1-1 Primary_Classifications relationship. |
POST . . /api/v3/ADW/DevelopmentTags Content-Type: application/json { "@odata.type": "#Intergraph.SPF.Server.API.Model.DevelopmentTag", "Name": "Tag-01-0010", "Description": "Tag-01-0010", Primary_Classification@odata.bind : "SPFClassifications(‘Key’)" } |
Create and Deep Link One to Many (n1)
Operator |
Description |
Example |
---|---|---|
Create and Deep Link One to Many (n1) |
This example creates an SPFFolder object, assigning the Name, Description, and Class properties. The SPFFolder object then establishes a relationship to an existing DevelopmentTag object through the 1-Many PlantItems relationship. |
POST . . /api/v3/ADW/SPFFolders Content-Type: application/json { "@odata.type": "#Intergraph.SPF.Server.API.Model.SPFFolder", "Name": "Folder-05-0010", "Description": "Folder-05-0010", "Class": "SPFFolder", "PlantItems@odata.bind" : ["DevelopmentTags('0039IHA')"] } |
Create and Deep Insert Link
Operator |
Description |
Example |
---|---|---|
Create and Deep Link Inser |
This example creates an SPFFolder object, a DEVSystem object, and a DevelopmentTag object. Both the DEVSystem object and the DevelopmentTag object are then related to the SPFFolder through the PlantItems relationship. |
POST . . /api/v3/ADW/SPFFolders Content-Type: application/json "@odata.type": "#Intergraph.SPF.Server.API.Model.SPFFolder", "Name": "Folder-05-0010", "Description": "Folder-05-0010", "DomainUID": "SPF", "PlantItems" : [ { "@odata.type": "#Intergraph.SPF.Server.API.Model.SPFPlantItem", "Name": "System-05-01-0010", "Description": "System-05-01-0010", "Class": "DEVSystem", "DEVHazardous": false }, { "@odata.type": "#Intergraph.SPF.Server.API.Model.SPFPlantItem", "Name": "Tag-05-01-0010", "Description": "Tag-05-01-0010" nm, "Class": "DevelopmentTag" } ] } |