Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Version: Windchill 13.0
Use Case: Creating a problem with REST API but can't adjust the folder location in the API body.
Description:
Not sure how to use the syntax perhaps but I tried everything that comes to mind and I'm not getting the expected result.
Here:
Context@odata.bind is the Context (wt.pdmlink.PDMLinkProduct:xxx)
Folder@odata.bind is ... what? I tried putting in versions of "Folders('OR:wt.folder.SubFolder:xxx')"
{
"Name": "",
"IssuePriority": {
"Value": ""
},
"Requester": "",
"State": {
"Value": ""
},
"TypeIcon": {
"Path": ""
},
"NeedDate": "2025-03-12T17:51:19.836Z",
"@odata.type": "",
"Context@odata.bind": "",
"Folder@odata.bind": "",
"Attachments@odata.bind": [
""
],
"CIAffectLinks@odata.bind": [
""
],
"AffectedObjects@odata.bind": [
""
]
}
There are also:
"FolderLocation" and "FolderName"... both seem to do nothing to set the location.
If I want the created problem report to go to a specific folder, what is the correct syntax in the body of the API?
Solved! Go to Solution.
refere to https://www.ptc.com/en/support/article/CS429060 , there is a step to adjust the OIR too :
{
"Requester": "u1",
"Category": {
"Value": "COST_REDUCTION"
},
"IssuePriority": {
"Value": "LOW"
},
"NeedDate": "2024-10-07T04:59:28.818Z",
"Number": "PR002",
"Description": "desc test",
"Name": "PR002",
"DescriptionSummary": "summary test",
"@odata.type": "",
"Context@odata.bind": "Containers('OR:wt.pdmlink.PDMLinkProduct:115304')",
"Folder@odata.bind": "Folders('OR:wt.folder.SubFolder:665511')",
"Attachments@odata.bind": [
""
]
}
<AttrConstraint id="folder.id" algorithm="com.ptc.core.rule.server.impl.GatherAttributeConstraints">
<Value algorithm="com.ptc.core.rule.server.impl.GetServerAssignedConstraint"/>
<!-- <Value algorithm="com.ptc.core.rule.server.impl.GetImmutableConstraint"/> -->
</AttrConstraint>
refere to https://www.ptc.com/en/support/article/CS429060 , there is a step to adjust the OIR too :
{
"Requester": "u1",
"Category": {
"Value": "COST_REDUCTION"
},
"IssuePriority": {
"Value": "LOW"
},
"NeedDate": "2024-10-07T04:59:28.818Z",
"Number": "PR002",
"Description": "desc test",
"Name": "PR002",
"DescriptionSummary": "summary test",
"@odata.type": "",
"Context@odata.bind": "Containers('OR:wt.pdmlink.PDMLinkProduct:115304')",
"Folder@odata.bind": "Folders('OR:wt.folder.SubFolder:665511')",
"Attachments@odata.bind": [
""
]
}
<AttrConstraint id="folder.id" algorithm="com.ptc.core.rule.server.impl.GatherAttributeConstraints">
<Value algorithm="com.ptc.core.rule.server.impl.GetServerAssignedConstraint"/>
<!-- <Value algorithm="com.ptc.core.rule.server.impl.GetImmutableConstraint"/> -->
</AttrConstraint>
I did ultimately have a tech support call and the thing that was missing from that support article was the OIR comment.
In my case, I didn't have the folder.id explicitly called out so there was no mechanism to set the folder with APIs. Once I added in the constraint (as you note above, commenting out the immutable portion), it worked as the support article suggests.
