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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

ODATA Create Folder

nbojcetic
11-Garnet

ODATA Create Folder

Hello,

can anybody have a hint of what am I doing wrong? I am trying to create subfolder in the Windchill, using Postman application but all I got is the message "The syntax of the JSON document is not valid.".

The query is POST:

https://<myserver>/Windchill/servlet/odata/v5/DataAdmin/Containers('OR:wt.pdmlink.PDMLinkProduct:169546')/Folders('OR:wt.folder.Cabinet:169590')/Folders('OR:wt.folder.SubFolder:248107')/Folders

 

and the body is: (the example is from WIndchill REST Guide 2.4 page 466.

{
 "Name": "NewFolder", 
 "Description" : "Desc",
}
 
the headers are:
nbojcetic_0-1680266646500.png

 

Also, Authorization is done using wcadmin account.

I tried different data in json body but without luck.

Does anyone have a clue what is the problem?

 

Best regards!

 

 

 

 

5 REPLIES 5

Hello,
I'm facing similar issue.
Using curl function I need to add \before each " of the body (it is working for checkout)
But with a normal send it is not working.
Did you solve it

HelesicPetr
22-Sapphire I
(To:nbojcetic)

Hi @nbojcetic 

Try to create the folder from a Windchill restApi documentation UI.

You can try it from the UI and you can find if the json is well formatted.

https://serverAdress.com/Windchill/netmarkets/html/wrs/doc.html

HelesicPetr_0-1721976275333.png

HelesicPetr_1-1721976370432.png

examples

"Folder@odata.bind": "Folders('OR:wt.folder.SubFolder:199456')"

"@odata.type": "#PTC.NavCriteria.WTPartStandardConfigSpec",

 

for the type I would try to find a type for the SubFolder. I guess it could be something like

"#PTC.Folder.SubFolder" but I don't know exactly. 

PetrH

 

@nbojcetic , @VB_2025784 Please use the Swagger UI to run endpoints, your payload does not contain all necessary data as @HelesicPetr explained.

 

Also, it could be a permission issue, try to create the folder on the exact context with the same user on the UI; but I guess it's not the root cause.

Any idea how to add the service to a ThingWorX OdataConnector? I found the endpoint createContainerInContainers/v6/DataAdmin/Containers Post but create Folder isn't shown. Looking at the Swagger JSON the parameters should be what is shown below. I tried adding that to the JSON Container parameters but it is not considered valid. I am looking for a way to create folders in Windchill from ThingWorx.

 

"parameters" : [ {
"name" : "ContainerId",
"in" : "path",
"description" : "The identification key for the item to get",
"required" : true,
"type" : "string"
}, {
"name" : "CSRF_NONCE",
"in" : "header",
"required" : true,
"type" : "string"
}, {
"in" : "body",
"name" : "body",
"required" : true,
"schema" : {
"$ref" : "#/definitions/Create.PTC.DataAdmin.Folder"
}
} ]

cko
12-Amethyst
12-Amethyst
(To:nbojcetic)

You must enter the default folder ID under the product

POST /Windchill/servlet/odata/DataAdmin/Containers(<oid>)/Folders(<oid>)/Folders

Folders(<oid>) : This is the default folder ID

EX) Containers('OR:wt.pdmlink.PDMLinkProduct:131308')/Folders('OR:wt.folder.Cabinet:131359')/Folders('OR:wt.folder.SubFolder:146353')/Folders"
sample VBA CODE

Please! tell me how to create wtpart       T.T . . . 

Announcements

Top Tags