REST API, Upload file, Stage2 'Failure'
I am using the ODATA REST API to try and upload new file content to a document per REST API Documentation: WCCG_RESTAPI_173713.pdf, Page ~51.
I have successfully executed Stage 1
POST https://server_base_addresshere/Windchill/servlet/odata/DocMgmt/Documents('OR%3Awt.doc.WTDocument%3A553531117')/PTC.DocMgmt.uploadStage1Action HTTP/1.1
Accept: application/xml
Authorization: Basic basicAuthHash
CSRF_NONCE: FFYxrn635KI1zhh0VyJmx0bN1OttoGAbYzweyD35ipN2mVwGfG5r1wSAi89hoC5HUGZFxgj9sZ8P/y1ALW8ImkiO1JsD/CI5Pz90gRfPtvJwgHEMc2IIlzyGhpt08yU=
Content-Type: application/json; charset=utf-8
Host: windchill.plexus.com
Cookie: JSESSIONID=92811C6234652861D37C0EEA3252D1CE.tomcat2
Content-Length: 15
Expect: 100-continue
{"noOfFiles":1}
I get back a successful set of replicaURL, MasterURL, streamIDs and FileNames.
I then create a stage 2 request following the guidelines in the rest document
POST https://replicaurlBaseAddressHere/Windchill/servlet/WindchillGW/wt.fv.uploadtocache.DoUploadToCache_Server/doUploadToChache_Replica?mk=wt.fv.uploadtocache.DoUploadToCache_Server&VaultId=1027696&FolderId=495134041&CheckSum=55879253&sT=1549994693&sign=q8pdvh4fy1dCM7srwl3%2BOwH2W0Wti7AEpgS2xpfdgHZMpHsTze1WPl2OiB%2FG3FyLPqJCU%2BBkjdbxXuX5IiE4Bw%3D%3D&site=https%3A%2F%2Fbasewindchilladdres.com%2FWindchill%2Fservlet%2FWindchillGW&AUTH_CODE=RSA&isProxy=true&delegate=wt.fv.uploadtocache.DefaultRestFormGeneratorDelegate HTTP/1.1 Accept: application/xml Authorization: Basic basicauthhash CSRF_NONCE: FFYxrn635KI1zhh0VyJmx0bN1OttoGAbYzweyD35ipN2mVwGfG5r1wSAi89hoC5HUGZFxgj9sZ8P/y1ALW8ImkiO1JsD/CI5Pz90gRfPtvJwgHEMc2IIlzyGhpt08yU= Content-Type: multipart/form-data; boundary="-----------------------------boundary" Host: replicaURLServerHostNameHere Content-Length: 3027 Expect: 100-continue -------------------------------boundary Content-Type: text/plain; charset=utf-8 Content-Disposition: form-data; name=Master_URL https://BaseWindchillurl.com/Windchill/servlet/WindchillGW -------------------------------boundary Content-Type: text/plain; charset=utf-8 Content-Disposition: form-data; name=CacheDescriptor_array 26646757:29232496:26646757 -------------------------------boundary Content-Type: text/plain Content-Disposition: form-data; name=26646757; filename=config.da0; filename*=utf-8''config.da0 [CFG] config last_saved "16:06:16, 08 Feb 2019" ...file contents here ... [ENDCFG] -------------------------------boundary--
This then is sent, and it "works" as in there is no error, but it returns an empty contentInfos structure:
HTTP/1.1 200 200
Date: Tue, 12 Feb 2019 18:04:56 GMT
Server: Apache/2.4.25 (Win64) mod_jk/1.2.42 OpenSSL/1.0.2k
X-Ptc-Connected: 1
X-Frame-Options: ALLOW-FROM https://windchillbaseurl.com
X-do-not-compress-this: 1
Vary: Accept-Encoding,User-Agent
access-control-allow-origin: https://windchillbaseurl.com
access-control-allow-credentials: true
expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Length: 19
Content-Type: text/json;charset=UTF-8
{"contentInfos":[]}
Does anyone have any ideas why? (note the listed data has been sanitized to remove company and password data. So far I have tried the following:
- A variety of different content types for each of the 3 multi part form parts.
- Fooled with the cache-descriptor lines a bit
- Have tried with the source document checked in, checked out, with an already existing file, and w/o.
Any help would be greatly appreciated because I feel like I'm super close to getting this working, but so far w/o any kind of error message to point me in the right direction.
Thanks, Josh Patterson

