Skip to main content
1-Visitor
September 12, 2022
Question

Unable to upload WTDocument content via rest

  • September 12, 2022
  • 1 reply
  • 901 views

I am getting the following when I try to run UploadStage3Action

{
 "error": {
 "code": null,
 "message": "Content holder must be checked out for content upload"
 }
}

 

Not sure what I am doing wrong.

 

Here is what I am passing in the body for UploadStage3Action

{
 "ContentInfo" : [
 {
 "StreamId" :726306,
 "EncodedInfo" : "726306%3A5184%3A779025%3A726306%3ANONE%3A1",
 "FileName" : "TOC.json",
 "PrimaryContent" : true,
 "MimeType" : "text/json",
 "FileSize" : 5184
 } 
 ]
}

URL used : https://<WCURL>/Windchill/servlet/odata/DocMgmt/Documents('OR:wt.doc.WTDocument:15196389')/PTC.DocMgmt.UploadStage3Action

 

For UploadToCache Server 

I used the following body data

-----------------------------boundary
Content-Disposition: form-data; name="Master_URL"

https://<WCURL>/Windchill/servlet/WindchillGW
-----------------------------boundary
Content-Disposition: form-data; name="CacheDescriptor_array"

726306:726306:726306
-----------------------------boundary
Content-Disposition: form-data; name="0000006124"; filename="TOC.json"

eyJUYWJsZU9mQ29udGVudHMiOn#TRUNCATED_DATA##
-----------------------------boundary--
 

 

Here is data obtained from UploadStage1

{
 "@odata.context": "$metadata#CacheDescriptor",
 "value": [
 {
 "FileNames": [
 726306
 ],
 "FolderId": 779025,
 "ID": null,
 "MasterUrl": "<WCURL>/Windchill/servlet/WindchillGW",
 "ReplicaUrl": "https://<WCURL>/Windchill/servlet/WindchillGW/wt.fv.uploadtocache.DoUploadToCache_Server/doUploadToCache_Master?mk=wt.fv.uploadtocache.DoUploadToCache_Server&VaultId=746601&FolderId=779025&SSC=1&CheckSum=1452612&sT=1662971140&sign=LVngsXMgfu0R%2BRUmzVlXcmLX2%2FmQeaaXSwnyM5o0IEk%3D&site=https%3A%2F%2<WCURL>%2FWindchill%2Fservlet%2FWindchillGW&AUTH_CODE=HmacSHA256&isProxy=true&delegate=wt.fv.uploadtocache.DefaultRestFormGeneratorDelegate",
 "StreamIds": [
 726306
 ],
 "VaultId": 746601
 }
 ],
 "@PTC.AppliedContainerContext.LocalTimeZone": "UTC"

 

1 reply

avillanueva
23-Emerald I
September 20, 2022

Does this article make sense to you?

https://www.ptc.com/en/support/article/cs305415?language=en&posno=2&q=update%20document%20via%20REST&source=search

Indicates first step is to check out the document which is what the error message is saying.