Home > Software design >  PTC Windchill WRS API Can't add attributes to WTParts on creation
PTC Windchill WRS API Can't add attributes to WTParts on creation

Time:12-21

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":{},
    "[email protected]":[],
    "[email protected]":[],
    "[email protected]":[],
    "[email protected]":[],
    "[email protected]":"Containers('OR:wt.pdmlink.PDMLinkProduct:109352')",
    "[email protected]":"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."}}

CodePudding user response:

Apparently, the underscore in CAT_CODE is not passed into the IBA attribute. So deleting the underscore fixed it. The correct data is

{
    "DefaultUnit":{},
    "EndItem":False,
    "GatheringPart":False,
    "DefaultTraceCode":{},
    "PhantomManufacturingPart":False,
    "ConfigurableModule":{},
    "Name":"pyapitest",
    "Source":{},
    "AssemblyMode":{},
    "[email protected]":[],
    "[email protected]":[],
    "[email protected]":[],
    "[email protected]":[],
    "CATCODE":"520000",
    "[email protected]":"Containers('OR:wt.inf.library.WTLibrary:110138')",
    "[email protected]":"Folders('OR:wt.folder.SubFolder:155247')",
}

Also, I noticed an issue with the [email protected] path which was malformed.

  • Related