My company is attempting to develop a web application that integrates with PDM using the PDM Web API. We would like our application to be able to automatically retrieve and update DataCard variables on certain files in the vault.
So far I have bees successful in retrieving DataCards for a file, however, editing variables and checking in those changes has given me quite some difficulty.
The existing documentation provides a postman collection for this exact purpose, however, I have been unable to get this working.
The sequence of requests looks like this:
POST: api/files/checkout
Body:
[{"FileId":"529","FolderId":"3"}]
Response:
Status: 200
[
{
"FileId": 529,
"IsSuccess": true,
"Warning": []
}
]POST: api/files/529/datacard
Body:
[
{
"Models": [
{
"ReadOnly": false,
"Multiline": true,
"VarId": 58,
"VarName": "Comment",
"VarValue": "API datacard test",
"VarType": 1,
"Mandatory": false,
"VersionFree": false
}
],
"ConfigurationName": "",
"ConfigurationId": 1
}
]
Response:
Status 200
truePUT: api/checkin/addfiles/0
Body:
--bee21932-0a3e-45a3-957d-e0b5f3e8f12e
Content-Type: multipart/form-data; boundary="9e7335f7-6a62-452b-a1b8-2b48586435e5"
Content-Disposition: form-data
--9e7335f7-6a62-452b-a1b8-2b48586435e5
Content-Type: application/x-www-form-urlencoded
Content-Disposition: form-data
DocumentId=529
--9e7335f7-6a62-452b-a1b8-2b48586435e5--
--bee21932-0a3e-45a3-957d-e0b5f3e8f12e--
Response:
Status 200
{
"ChangesetId": 11,
"References": []
}PUT api/checkin/11
Body:
{
"DocumentIds": [
529
],
"Comments": "Test Checking in files from API"
}
response:
status 202
49c35289-14c3-4003-9c3e-056fc9784f19
All of the requests return without error which to me should imply that the file was checked out, its DataCard was modified, then it was checked back in with those changes. However when I look at the file in question in the vault it appears to have been checked out but it has not been checked back in with the changes. My suspicion is that the file is not correctly being added to the changeset and thus is not being checked back in. However, I have not been able to figure out exactly what I am doing wrong in this request.
I have also tried adding an api/checkin/buildtree request after the addfile request but this does not seem to help.
If there are any experts out there who know how to correctly accomplish this, your advice would be much appreciated.
