Hi @ollieblanks,
Thank your answer. Does it mean it's not possible to check in an item deletion if the file has already been removed from the workspace?
I tried your suggestion, but I still can't' check in the deletion. Here's what I've been trying to do:
I have a workspace named "test_decentralized", with a "cube.glb" file at the root of this workspace. I want to be able to delete this file and check in this deletion.
wkname = "test_decentralized"
path = "cube.glb" # Its actual filepath on my system is "C:\\Users\\Baptiste\\wkspaces\\test_decentralized\\cube.glb"
# Checkout the file
url = __api_url + f"/wkspaces/{wkname}/content/{path}"
res = requests.put(url)
print(f"req.status_code = {res.status_code}")
if res.status_code != 200:
raise
print(res.json()) # -> seems to work, I get "{'affectedPaths': ['c:\\Users\\Baptiste\\wkspaces\\test_decentralized\\cube.glb']}"
# Locally remove the file
os.remove("C:\\Users\\Baptiste\\wkspaces\\test_decentralized\\cube.glb")
# Try to checkin this deletion
url = __api_url + "wkspaces/test_decentralized/checkin"
params = {
"paths": ["cube.glb"], # I also tried passing an empty list this empty
"comment": "Deleting a file",
"recurse": True,
}
res = requests.post(
url,
headers={
"Content-type": "application/json",
"Accept": "application/json",
},
data=json.dumps(params),
)
print(res.json()) # -> {'totalSize': 0, 'transferredSize': 0, 'status': 'Checkin operation starting...'}
res = requests.get(__api_url + f"wkspaces/{wkname}/checkin")
print(res.json()) # -> {'status': 'Failed', 'message': 'The item c:\\Users\\Baptiste\\wkspaces\\test_decentralized\\cube.glb does not exist in the workspace.'}
The cube.glb file is liested in Plastic GUI in the "Pending Changes" tab, as a deleted item with a status "Removed locally".
Cheers,
Baptiste