Windchill REST Services Framework Capabilities > Getting Information About Windchill Constraints
Getting Information About Windchill Constraints
In Windchill, you can apply constraints to attributes. The constraints are applied in the Type and Attribute Manager utility, or in Object Initialization Rules. In Windchill, the constraints are applied at site, organization, product, and library levels. For example, in the Type and Attribute Manager utility, you can apply a Legal value list constraint to an attribute. When you apply this constraint, the attribute can only take permitted values specified in the constraint.
Constraints can be applied using an OIR. For example, when an attribute like Number takes the value which is automatically generated by the server either at time of persistence or a pre-generated value before persistence.
Entity properties that map to Windchill type attributes adhere to the constraints that are applied by the server. To provide valid values for these properties, the clients must know the constraints that were applied in Windchill to these entity properties.
Windchill REST Services provides functions that can be used to query for constraints that have been applied to the entity properties. These functions are bound to containers and can be called for site, organization, product, or library containers. The following functions are available:
GetDriverProperties—Gets the driver properties defined for the given entity type. Driver properties are used by the server to select the constraints applied to certain property values. For example, the following GET request calls the function to get the driver properties for a Part entity type:
GET DataAdmin/Containers('OR:wt.pdmlink.PDMLinkProduct:92350')/PTC.DataAdmin.GetDriverProperties(EntityName='PTC.ProdMgmt.Part')
GetConstraints—Gets the constraints defined on a specific entity property or on all properties of an entity type. The PropertyConstraints type that is returned contains information about the visibility constraints in Windchill for each attribute.
For example, the following GET request calls the function to get the constraints on all the properties for a Part entity type:
GET DataAdmin/Containers('OR:wt.pdmlink.PDMLinkProduct:92350')/PTC.DataAdmin.GetConstraints(EntityName='PTC.ProdMgmt.Part',DriverProperties=@props)?@props={“Items”:[{“Name”:”EndItem”,”Type”:”Edm.Boolean”,”Value”:"true"}]}
GetPregeneratedValue—Gets the server generated value for an entity property for which a pre-generated constraint is set in the OIR. For example, the following GET request calls the function to get the pre-generated value for the property Number on entity type Part:
GET DataAdmin/Containers('OR:wt.pdmlink.PDMLinkProduct:92350')/PTC.DataAdmin.GetPregeneratedValue(EntityName='PTC.ProdMgmt.Part',PropertyName='Number',DriverProperties=@props)?@props={“Items”:[{“Name”:”EndItem”,”Type”:”Edm.Boolean”,”Value”:"true"}]}