Delete Archives

Hi,
I would like to delete all archives before each execution of a specific plan as a pre-job.
Postman return me those query parameters :
I get all information required like that :
$Locations = Invoke-RestMethod -Method "GET" -Uri "${baseUrl}bc/api/vault_manager/v1/vaults?count=1&includeStats=true&limit=30&order=asc(name)" -Headers $headers -ContentType "application/json"
$Location = $Locations.items | Select-Object {$_.uri}, {$_.id}, {$_.managing_agent_id} | where {$_.uri} -like "*usbshare1*"
$VaultId = $Location.'$_.id'
$MachineId = $Location.'$_.managing_agent_id'
$Archives = Invoke-RestMethod -Method "GET" -Uri "${baseUrl}bc/api/vault_manager/v1/vaults/$VaultId/archives" -Headers $headers -ContentType "application/json"
$ArchivesId = $Archives.items | Select-Object {$_.legacy_id}
$ArchivesId = $ArchivesId.'$_.legacy_id'[0]
Put every parameters in a body :
$paramarchives = @"
{
"archiveId": "$ArchivesID",
"machineId": "$MachineId",
"operationId": "va-rem-1-7",
"subscriptionId": "1",
}
And then try to delete in that case a single archive to test it ($ArchivesId.'$_.legacy_id'[0]) :
$Archives = Invoke-RestMethod -Method "DELETE" -Uri "${baseUrl}bc/api/ams/archives/" -Headers $headers -ContentType "application/json" -Body $paramarchives
I also tried to delete archive like that without any success :
$Archives = Invoke-RestMethod -Method "DELETE" -Uri "${baseUrl}bc/api/ams/archives/%3CpatharchiveId%3E?archiveId=$ArchivesID&machineId=$MachineId&subscriptionId=5&operationId=va-rem-5-1" -Headers $headers -ContentType "application/json"
Each time powershell console tell me that :
Invoke-RestMethod : {"reason":"wcsInternalError","origin":"_delete_archive_by_key_arg() missing 1 required positional argument:
'machineId'","effect":null,"context":{"_internal":"100011:-1:-1"},"date":"2020-07-16T11:40:39.417414+00:00","troubleshoot":null,"cause":"Internal server error."}
Au caractère C:\temp\acronis_suppression_backups_api.ps1:217 : 13
+ $Archives = Invoke-RestMethod -Method "DELETE" -Uri "${baseUrl}bc/api ...
Can someone help me with that ?

Ok thank you for you answer.
Also I noticed slight difference between the request that I have thanks to archives items (legacy_id) :
"/bc/api/ams/archives/%3CpatharchiveId%3E?archiveId=smb:/10.69.158.248/homes/Sauvegarde/#arl:/00000000-0000-0000-0000-000000000000/00000000-0000-0000-0000-000000000000/D071568E-B014-2A97-C3C3-39DAC4B077B0?archive_name=_ADM-NAS-04-81A01C77-9DE8-44E9-BD15-5FB0F92CE8F3-720431CA-66F7-444E-8311-AE3088DC7172A&machineId=5C9D4EBB-F654-4492-976D-FB9B2D32EE06&subscriptionId=1&operationId=va-rem-1-0" -Headers $headers -ContentT"
And the one from my postman request :
"/bc/api/ams/archives/%3CpatharchiveId%3E?archiveId=smb%3A%2F10.69.158.248%2Fhomes%2FSauvegarde%2F%23arl%3A%2F00000000-0000-0000-0000-000000000000%2F00000000-0000-0000-0000-000000000000%2FD071568E-B014-2A97-C3C3-39DAC4B077B0%3Farchive_name%3D_ADM-NAS-04-81A01C77-9DE8-44E9-BD15-5FB0F92CE8F3-720431CA-66F7-444E-8311-AE3088DC7172A&machineId=5C9D4EBB-F654-4492-976D-FB9B2D32EE06&subscriptionId=2&operationId=va-rem-2-6"
Values changing between : ":/" to "%3A%2F" ; "/" to "%2F".
Do you have something that can do the trick or request the second value in another way ?
EDIT :
I succeeded to pass the machineid not found error with the percent-encoding : $ArchivesID = [System.Web.HttpUtility]::UrlEncode("$ArchivesID")
But now it said that "subscriptionID" is not found :
Invoke-RestMethod : {"reason":"wcsSubscriptionNotFound","stacktrace":null,"effect":null,"context":{"_internal":"100005:-1:-1","sub_id":"3"},"date":"2020-07-17T08:36:49.905596+00:00","troubleshoot":null,"cause":"Subscription with id \"3\" not
found."}
I didn't found somewhere to look for in order to get this value related to each archives.
Also the some for "operationId"
Do you now where I can find those specific values ?
EDIT 2 :
I found out that both last paramaters are not "required" so everything working fine now.
- Anmelden, um Kommentare verfassen zu können

JFYI
To use subscription, you need to create it before the first call with all these API, with that you receive all updated values in case they are, with call for subscription by subscription id.
- Anmelden, um Kommentare verfassen zu können
Stas Pavlov | Technology Evangelist
Acronis Developer Network | Acronis Cyber Cloud Solutions Portal | Acronis Cyber Platform
For more answers to your questions, try our Knowledge Base and Video Tutorials
Our mission is to create Customers and Partners success. Our management team welcomes your comments and suggestions on how we can improve the overall support we provide to you. Please send your comments, suggestions, or concerns to Managers or submit your feedback here.
Stas Pavlov | Technology Evangelist
Acronis Developer Network | Acronis Cyber Cloud Solutions Portal | Acronis Cyber Platform
For more answers to your questions, try our Knowledge Base and Video Tutorials
Our mission is to create Customers and Partners success. Our management team welcomes your comments and suggestions on how we can improve the overall support we provide to you. Please send your comments, suggestions, or concerns to Managers or submit your feedback here.