This is an old revision of the document!
payloads:delete_payload
The payloads web service is a REST structured service that derives its functionality based on syntax used when calling the web service. To delete a payload from a repository, call the payloads web service with a repository name and the payload file name.
Important: The payload must be locked prior to retrieving it. Please note that the method being used is DELETE.
Purpose: Delete A Payload From A Repository.
Request Endpoint
Method | URL |
---|---|
DELETE | https://apex-prd.certna.org/APEX/Service/APEXPublicServer.svc/payloads/{repository}/{payload_name} |
Variables:
Variable | Usage | Description |
---|---|---|
{repository} | Required | The name of the repository |
{payload_name} | Required | The name of the payload |
Request Body
N/A
Request Headers
Key | Value |
---|---|
access_token | {soft-token} |
JSON Request Parameters
N/A
Notes:
Any condition that results in an unsuccessful call to the payloads web service will produce a JSON formatted response with a code and message property populated.
Sample Request
Endpoint:
https://apex-prd.certna.org/APEX/Service/APEXPublicServer.svc/payloads/retrieve/standard_testagent1-202007140415-00025.1.1_200723151419729.xml
Sample Response (Note: Most of the Base64 image text was removed for readability.)
Status Code: 200
{ "result": "true" }
OR
Status Code: 500 (When an error occurs.)
{ "Exception": { "Code": "PayloadFileLockError", "Message": "The payload standard_testagent1-202007140415-00025.1.1_200723151419729.xml not locked." } }
private bool DeleteRemoteFile(string strRepositoryType, string strFileName) { tbMessageLine.Text = "Deleting remote file " + strFileName; bool rc = false; RestClient client = null; RestRequest request = null; IRestResponse response = null; string strURL = "https://apex-prd.certna.org/APEX/Service/APEXPublicServer.svc/user/login"; // Password has to be hashed. // New convention uses a Salt value from the user record // See the Login web service for more detail string strSalt = GetSalt(tbUserName.Text); string strPassword = tbPassword.Password.ToString(); string strHashedPassword = HashPassword(strPassword, strSalt); string strParms = "{\n\t\"user_name\" : \""; strParms += tbUserName.Text; strParms += "\",\n\t\"password\" : \""; strParms += strHashedPassword; strParms += "\"\n}"; client = new RestClient(strURL); request = new RestRequest(Method.POST); request.AddHeader("Cache-Control", "no-cache"); request.AddHeader("Content-Type", "application/json"); request.AddParameter("Login", strParms, ParameterType.RequestBody); response = client.Execute(request); if (response.IsSuccessful) { var jsonResult1 = JsonConvert.DeserializeObject<dynamic>(response.Content); string token = jsonResult1.access_token; strURL = null; client = null; request = null; response = null; strURL = "https://apex-prd.certna.org/APEX/Service/APEXPublicServer.svc/payloads/" + strRepositoryType + "/" + strFileName; client = new RestClient(strURL); request = new RestRequest(Method.DELETE); request.AddHeader("Cache-Control", "no-cache"); request.AddHeader("access_token", token); response = client.Execute(request); if (response.IsSuccessful) { tbMessageLine.Text = "Remote file " + strFileName + " successfully retrieved. Remote file deleted."; rc = true; } else { var jsonResult2 = JsonConvert.DeserializeObject<dynamic>(response.Content); string strMessage = jsonResult2.Exception.Message; tbMessageLine.Text = strMessage; } } else { var jsonResult2 = JsonConvert.DeserializeObject<dynamic>(response.Content); tbMessageLine.Text = jsonResult2.ToString(); } return (rc); }
Comment 2:
A nice utility for experimenting with web service calls is POSTMAN. You can download a free version of POSTMAN from the following URL: https://www.getpostman.com/apps