Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Translate the entire conversation x

POST /ProblemReports folder location

Dobi
16-Pearl

POST /ProblemReports folder location

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? 

ACCEPTED SOLUTION

Accepted Solutions
Fadel
22-Sapphire II
(To:Dobi)

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>
Fede

View solution in original post

2 REPLIES 2
Fadel
22-Sapphire II
(To:Dobi)

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>
Fede
Dobi
16-Pearl
(To:Fadel)

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. 

 

 

Announcements


Top Tags