Windchill REST Services > Windchill REST Services Domain Capabilities > Examples for Basic REST Operations > Examples for the PTC Product Management Domain > Creating Multiple Parts
  
Creating Multiple Parts
This example shows you how to create multiple parts. Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/ProdMgmt/CreateParts HTTP/1.1
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"Parts": [
{
"Name": "test1",
"AssemblyMode": {
"Value": "inseparable"
},
"DefaultUnit": {
"Value": "kg"
},
"DefaultTraceCode": {
"Value": "X"
},
"Source": {
"Value": "buy"
},
"Context@odata.bind": "Containers('OR:wt.pdmlink.PDMLinkProduct:302725')"
},
{
"Name": "test2",
"AssemblyMode": {
"Value": "separable"
},
"DefaultUnit": {
"Value": "ea"
},
"DefaultTraceCode": {
"Value": "L"
},
"Source": {
"Value": "make"
},
"Context@odata.bind": "Containers('OR:wt.pdmlink.PDMLinkProduct:302725')"
}
]
}
Example: Creating Multiple Parts with Security Labels
This example shows you how to create two parts with security labels. In this example, two standard security label attributes, SecrecyLabel and SL10 along with other attributes are specified for each part in the request body. Use the following POST URI with the request body.
* 
To set the values of the standard security label attributes which are available in the EDM of the entity, you must specify the internal names of their values in the request body.
You can specify unrestricted (standard and custom) or restricted security label attributes in the request body.
If restricted security label attributes are specified or if the access to an entity is restricted, the request creates the entity object in Windchill, but the response does not contain the entity.
URI
POST /Windchill/servlet/odata/ProdMgmt/CreateParts HTTP/1.1
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"Parts": [
{
"Name": "test1",
"AssemblyMode": {
"Value": "inseparable"
},
"DefaultUnit": {
"Value": "kg"
},
"DefaultTraceCode": {
"Value": "X"
},
"Source": {
"Value": "buy"
},
"SecrecyLabel": "Secret2",
"SL10": "v1",
"Context@odata.bind": "Containers('OR:wt.pdmlink.PDMLinkProduct:302725')"
},
{
"Name": "test2",
"AssemblyMode": {
"Value": "separable"
},
"DefaultUnit": {
"Value": "ea"
},
"DefaultTraceCode": {
"Value": "L"
},
"Source": {
"Value": "make"
},
"SecrecyLabel": "Secret2",
"SL10": "v1",
"Context@odata.bind": "Containers('OR:wt.pdmlink.PDMLinkProduct:302725')"
}
]
}