cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

REST API POST method to Upload Primary Content to Document

MT_11904685
8-Gravel

REST API POST method to Upload Primary Content to Document

I am trying to upload the primary content to a document using REST API. I found information on knowledge hub to do it using Upload Stage 1, Upload Stage 2, Upload Stage 3 actions. I am facing issue while stage 2 action as it is not available in windchill rest services(screenshot attached). I am wondering if it is possible to customize the Document Management domain to perform POST action to upload document primary content directly through rest api. Any hint or assistance will be greatly appreciated.

Thanks in advance for time and consideration.

 

Screenshot 2024-11-25 114407.png

 

2 REPLIES 2

Hi @MT_11904685 

 

Thank you for your question! 

 

Please consider adding screenshot(s) to better understand what you are trying to do in your process. 

 

Please refer to this guideline to make your questions more likely to receive a quick and useful answer. 

This will increase your chances to receive meaningful help from other Community members. 

 

Thank you for your participation and please let me know if you need further assistance! 

 

Best regards,

Catalina
PTC Community Moderator
tm-4
12-Amethyst
(To:MT_11904685)

Hi,

To create a document with content, i suggest to use a batch mode. Refer example below,

 

tm4_0-1732696335818.png

Body

--batch
Content-Type: multipart/mixed;boundary=changeset

--changeset
Content-ID: 1
Content-Type: application/http
Content-Transfer-Encoding:binary

POST Documents HTTP/1.1
Content-Type: application/json

{
  "Name": "Created Through PostMan",
  "@odata.type": "PTC.DocMgmt.MyDocType",
  "Context@odata.bind": "Containers('OR:wt.pdmlink.PDMLinkProduct:xxxxxxx')",
  "Folder@odata.bind": "Folders('OR:wt.folder.SubFolder:xxxxxxxx')",
  "DocumentLanguage": {
        "Value": "EN"
      },
       "ClassificationLevel": {
        "Value": "1"
      },
      "SubType": "10"
}

--changeset
Content-Type: application/http
Content-ID: 2
Content-Transfer-Encoding:binary

POST $1/PTC.DocMgmt.CheckOut HTTP/1.1
Content-Type: application/json

{

}

--changeset
Content-Type: application/http
Content-ID: 3
Content-Transfer-Encoding:binary

PUT $2/PrimaryContent HTTP/1.1
Content-Type: multipart/form-data; boundary=ContentSeparator

--ContentSeparator
Content-Disposition: form-data; name="primaryFilepathInput";filename="helloworld.txt"
Content-Type: text/plain

Hello, World!

--ContentSeparator--

--changeset
Content-Type: application/http
Content-ID: 4
Content-Transfer-Encoding:binary

POST $2/PTC.DocMgmt.CheckIn HTTP/1.1
Content-Type: application/json

{

}

--changeset--

--batch--

 

Announcements

Top Tags