Three-Stage Upload of Attachments to a Change Issue
This example shows how to upload attachments to a Change Issue (a problem report in this example). The upload is a three-stage process.
|
Although Security Labels cannot be specified as part of the content upload using the WRS Change Management domain, all security label constraints for file vaulting will be respected for WRS.
|
• Stage 1 — Specify the number of files to attach in the request body. The change object to which the attachment is added must be reserved before running this step. Use the following POST URI with the request body.
POST /Windchill/servlet/odata/ChangeMgmt/ProblemReports('OR%3Awt.change2.WTChangeIssue%3A250033')/PTC.ChangeMgmt.UploadStage1Action HTTP/1.1
Request Body:
{
"NoOfFiles": 1
}
Stage 2 — Use the following POST URI with the request body:
Copy the replica URI from the response you get from Stage 1 and use it as the POST URI as shown below:
POST /Windchill/servlet/WindchillGW/wt.fv.uploadtocache.DoUploadToCache_Server/doUploadToCache_Master?mk=wt.fv.uploadtocache.DoUploadToCache_Server&VaultId=241504&FolderId=241512&CheckSum=28002&sT=1613039289&sign=pd%2F3ho7xrcUOoZw61A0w6x85sVBth3xnGvv2esgYffA%3D&site=http%3A%2F%2Fvagrant.ptcnet.ptc.com%3A2280%2FWindchill%2Fservlet%2FWindchillGW&AUTH_CODE=HmacSHA256&isProxy=true&delegate=wt.fv.uploadtocache.DefaultRestFormGeneratorDelegate HTTP/1.1
Stage 3 —Use the following POST URI with the request body:
POST /Windchill/servlet/odata/ChangeMgmt/ProblemReports('OR%3Awt.change2.WTChangeIssue%3A250033')/PTC.ChangeMgmt.UploadStage3Action HTTP/1.1
Request Body:
The StreamId, FileSize, and EncodedInfo are obtained from the response of Stage 2.
{
"ContentInfo": [
{
"StreamId": 14001,
"FileSize": 1213819,
"EncodedInfo": "14001%3A1213819%3A241512%3A14001",
"MimeType": "application/pdf",
"PrimaryContent": false,
"FileName": "mypdf2.pdf"
}
]
}