Updating an Existing Windchill Object by Adding Rich Text Images to the LongDescription Attribute and Uploading the Images
You can update an existing Windchill object by uploading one or more rich text images to the object in three stages:
1. Generating unique file names for rich text images before uploading them using GetUniqueRichTextImageNames().
|
|
We recommend using the GetUniqueRichTextImageNames() function before updating a Windchill object to upload images. The generated file names are unique and must not be reused.
|
2. Updating an object using the generated unique file names for persisting the rich text content.
3. Uploading rich text images to an object using the UploadRichTextImages action available in the corresponding domain.
|
|
Objects in different domains may have different attributes that support rich text content. For example:
• In the Change Management domain, the Description attribute, along with other attributes, supports rich text content.
• In the Manufacturing Process Management domain, the LongDescription attribute, along with other attributes, supports rich text content.
|
The UploadRichTextImages action does not check out the specified object during image upload.
|
|
We recommend using the latest version of an object for uploading the rich text images.
|
The following example demonstrates how to add three rich text images to the LongDescription attribute of an existing process plan object in the Manufacturing Process Management domain.
• Stage #1: Generating unique file names for rich text images before uploading them
|
|
Only the following image types are supported: JPG, JPEG, PNG, GIF, and WEBP.
|
In each JSON element, specify the image type and the count of unique file names to be generated for the specified image type in the request URI.
Use the following GET URI.
URI
GET /Windchill/servlet/odata/PTC/GetUniqueRichTextImageNames(imageNamesToGenerateFor=@p1)?@p1=[{"imageType":"png","count":1},{"imageType":"jpg","count":2}]
Stage #1—Sample Response
{
"@odata.context": "http://vagrant.ptcnet.ptc.com:2280/Windchill/servlet/odata/v5/PTC/$metadata#Collection(PTC.RichTextImageUniqueFileNames)",
"@PTC.AppliedContainerContext.LocalTimeZone": "Asia/Calcutta",
"value": [
{
"FileType": "png",
"FileNames": [
"41cc0f3e-66ed-42ad-9c2c-0f247a0e65dc-1773656717930.png"
]
},
{
"FileType": "jpg",
"FileNames": [
"89ea9552-9b64-4887-a2e0-07e055319730-1773656717931.jpg",
"62d2515f-e9bb-4219-8035-0b7f3bc513f4-1773656717931.jpg"
]
}
]
}
• Stage #2—Updating an existing process plan using the generated unique file names for persisting the rich text content
Copy the values of FileNames from the Stage #1 response, and then use them in the LongDescription attribute in the request body of the POST URI of Stage #2.
In the LongDescription attribute, paste the respective value in filename, which is a required attribute, in the corresponding <img> tag to persist the rich text content.
To update the process plan using the generated unique file names, use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/MfgProcMgmt/UpdateProcessPlans
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
• Stage #3—Uploading rich text images to the updated process plan object.
|
|
You can upload image files up to 10 MB in size.
|
To upload the rich text image files to the process plan, specify the process plan OID in the request URI.
Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/MfgProcMgmt/ProcessPlans('OR:com.ptc.windchill.mpml.processplan.MPMProcessPlan:314348')/PTC.MfgProcMgmt.UploadRichTextImages
Request Headers
CSRF_NONCE: <CSRF_NONCE_TOKEN>
Content-Type: multipart/form-data; boundary=----contentBoundary
Request Body
Content-Disposition: form-data; name="41cc0f3e-66ed-42ad-9c2c-0f247a0e65dc-1773656717930.png"; filename="engine.png"
(data)
Content-Disposition: form-data; name="89ea9552-9b64-4887-a2e0-07e055319730-1773656717931.jpg"; filename="axle.jpg"
(data)
Content-Disposition: form-data; name="62d2515f-e9bb-4219-8035-0b7f3bc513f4-1773656717931.jpg"; filename="wheel.jpg"
(data)
Stage #3—Sample Response
{
"@odata.context": "http://vagrant.ptcnet.ptc.com:2280/Windchill/servlet/odata/v7/MfgProcMgmt/$metadata#ProcessPlans/$entity",
"CreatedBy": "Site, Administrator",
"CreatedOn": "2026-03-16T16:27:49+05:30",
"ID": "OR:com.ptc.windchill.mpml.processplan.MPMProcessPlan:314348",
"LastModified": "2026-03-16T16:27:49+05:30",
"MasterID": "OR:com.ptc.windchill.mpml.processplan.MPMProcessPlanMaster:314345",
"ModifiedBy": "Site, Administrator",
"Name": "PP_Image_update001",
"Number": "0000000002",
"CabinetName": "Default",
"Category": {
"Value": "production",
"Display": "Production"
},
"CheckOutStatus": "",
"CheckoutState": "Checked in",
"Comments": null,
"Description": null,
"FolderLocation": "/GOLF_CART",
"FolderName": null,
"Latest": true,
"LifeCycleTemplateName": "Basic",
"LongDescription": "This is Long Description Image1: <img src=\"http://vagrant.ptcnet.ptc.com:2280/Windchill/servlet/WindchillAuthGW/wt.content.ContentHttp/viewContent/41cc0f3e-66ed-42ad-9c2c-0f247a0e65dc-1773656717930.png?u8&ContentHolder=com.ptc.windchill.mpml.processplan.MPMProcessPlan%3A314348&HttpOperationItem=wt.content.ApplicationData%3A314360&forceDownload=true\" filename=\"41cc0f3e-66ed-42ad-9c2c-0f247a0e65dc-1773656717930.png\" imageappdataref=\"wt.content.ApplicationData:314360\" style=\"width: 300px; display: block; vertical-align: top; margin: 5px auto; text-align: center;\" /> Image2: <img src=\"http://vagrant.ptcnet.ptc.com:2280/Windchill/servlet/WindchillAuthGW/wt.content.ContentHttp/viewContent/89ea9552-9b64-4887-a2e0-07e055319730-1773656717931.jpg?u8&ContentHolder=com.ptc.windchill.mpml.processplan.MPMProcessPlan%3A314348&HttpOperationItem=wt.content.ApplicationData%3A314362&forceDownload=true\" filename=\"89ea9552-9b64-4887-a2e0-07e055319730-1773656717931.jpg\" imageappdataref=\"wt.content.ApplicationData:314362\" style=\"width: 300px; display: block; vertical-align: top; margin: 5px auto; text-align: center;\" /> Image3: <img src=\"http://vagrant.ptcnet.ptc.com:2280/Windchill/servlet/WindchillAuthGW/wt.content.ContentHttp/viewContent/62d2515f-e9bb-4219-8035-0b7f3bc513f4-1773656717931.jpg?u8&ContentHolder=com.ptc.windchill.mpml.processplan.MPMProcessPlan%3A314348&HttpOperationItem=wt.content.ApplicationData%3A314358&forceDownload=true\" filename=\"62d2515f-e9bb-4219-8035-0b7f3bc513f4-1773656717931.jpg\" imageappdataref=\"wt.content.ApplicationData:314358\" style=\"width: 300px; display: block; vertical-align: top; margin: 5px auto; text-align: center;\" />",
"ObjectType": "Process Plan",
"OccurrenceLevel": false,
"OrganizationName": "Demo Organization",
"ProcessPlanQuantity": 1.0,
"PublishBasedOnPartTags": false,
"Revision": "A",
"Standard": false,
"State": {
"Value": "INWORK",
"Display": "In Work"
},
"Unit": "ea",
"Version": "A.1 (Design) (Production)",
"VersionID": "VR:com.ptc.windchill.mpml.processplan.MPMProcessPlan:314347",
"View": "Design",
"WorkCentersForLocalization": [
" "
],
"WorkInProgressState": {
"Value": "c/i",
"Display": "Checked in"
},
"@PTC.AppliedContainerContext.LocalTimeZone": "Asia/Calcutta"
}
The request returns the LongDescription attribute with <img> tags that include an src attribute for retrieving the corresponding image content.
All three images are uploaded to the specified process plan and displayed in the Long Description field on the information page of the process plan object.