Skip to main content
17-Peridot
March 12, 2025
Solved

POST /ProblemReports folder location

  • March 12, 2025
  • 1 reply
  • 493 views

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? 

Best answer by Fadel

refere to https://www.ptc.com/en/support/article/CS429060 , there is a step to adjust the OIR too : 

 

  • Sample Request Body: 
{
 "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": [
 ""
 ]
}
  • Comment out the following line from the Problem Report OIR when specifying the folder where the Problem Report is to be created. 
  • <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>

1 reply

Fadel
Fadel23-Emerald IAnswer
23-Emerald I
March 26, 2025

refere to https://www.ptc.com/en/support/article/CS429060 , there is a step to adjust the OIR too : 

 

  • Sample Request Body: 
{
 "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": [
 ""
 ]
}
  • Comment out the following line from the Problem Report OIR when specifying the folder where the Problem Report is to be created. 
  • <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>
Buiꓘa
Dobi17-PeridotAuthor
17-Peridot
March 26, 2025

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.