cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Windchill WRS API - Can't add attributes to WTParts on creation

TM_10200690
5-Regular Member

Windchill WRS API - Can't add attributes to WTParts on creation

 

How can I add data to our custom attributes via the WRS API? We have an attribute for WTParts called "CAT_CODE" and I want to add data to it via the CreatePart command (http://##.###.#.##:##/Windchill/servlet/odata/v5/ProdMgmt/Parts). My data is:

{
    "DefaultUnit":{},
    "EndItem":False,
    "GatheringPart":False,
    "DefaultTraceCode":{},
    "PhantomManufacturingPart":False,
    "ConfigurableModule":{},
    "Name":"pyapitest",
    "Source":{},
    "AssemblyMode":{},
    "Uses@odata.bind":[],
    "DescribedBy@odata.bind":[],
    "References@odata.bind":[],
    "PartDocAssociations@odata.bind":[],
    "Context@odata.bind":"Containers('OR:wt.pdmlink.PDMLinkProduct:109352')",
    "Folder@odata.bind":"Containers('OR:wt.folder.SubFolder:155247')",
    "CAT_CODE": "52",
}

The error code I get when running the POST command is

 

{"error":{"code":null,"message":"'CAT_CODE' can not be mapped as a property or an annotation."}}

 

1 ACCEPTED SOLUTION

Accepted Solutions
TM_10200690
5-Regular Member
(To:TM_10200690)

Ok, I had a couple issues with the data. The corrected data is:

 

 

{
    "DefaultUnit":{},
    "EndItem":False,
    "GatheringPart":False,
    "DefaultTraceCode":{},
    "PhantomManufacturingPart":False,
    "ConfigurableModule":{},
    "Name":partname + "_pyapitest",
    "Source":{},
    "AssemblyMode":{},
    "Uses@odata.bind":[],
    "DescribedBy@odata.bind":[],
    "References@odata.bind":[],
    "PartDocAssociations@odata.bind":[],
    "CATCODE":"520000",
    "Context@odata.bind":"Containers('OR:wt.inf.library.WTLibrary:110138')",
    "Folder@odata.bind":"Folders('OR:wt.folder.SubFolder:155247')",
}

 

 

The weird thing is that our IBA "CAT_CODE" can only be mapped when we remove the underscore and make it "CATCODE"...

View solution in original post

1 REPLY 1
TM_10200690
5-Regular Member
(To:TM_10200690)

Ok, I had a couple issues with the data. The corrected data is:

 

 

{
    "DefaultUnit":{},
    "EndItem":False,
    "GatheringPart":False,
    "DefaultTraceCode":{},
    "PhantomManufacturingPart":False,
    "ConfigurableModule":{},
    "Name":partname + "_pyapitest",
    "Source":{},
    "AssemblyMode":{},
    "Uses@odata.bind":[],
    "DescribedBy@odata.bind":[],
    "References@odata.bind":[],
    "PartDocAssociations@odata.bind":[],
    "CATCODE":"520000",
    "Context@odata.bind":"Containers('OR:wt.inf.library.WTLibrary:110138')",
    "Folder@odata.bind":"Folders('OR:wt.folder.SubFolder:155247')",
}

 

 

The weird thing is that our IBA "CAT_CODE" can only be mapped when we remove the underscore and make it "CATCODE"...

Top Tags