Site Tools


guides:ws_payloads_delete_payload

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
guides:ws_payloads_delete_payload [2020/08/24 00:51] brett.zamoraguides:ws_payloads_delete_payload [2020/08/24 23:41] (current) brett.zamora
Line 3: Line 3:
 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. 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.+**Important:** The payload must be locked prior to retrieving it. Please note that the method being used is DELETE.
  
 ---- ----
Line 51: Line 51:
 **Endpoint:** **Endpoint:**
  
-<nowiki>https://apex-prd.certna.org/APEX/Service/APEXPublicServer.svc/payloads/retrieve/standard_testagent1-202007140415-00003.1.1_200723151458170.xml</nowiki>+<nowiki>https://apex-prd.certna.org/APEX/Service/APEXPublicServer.svc/payloads/retrieve/standard_testagent1-202007140415-00025.1.1_200723151419729.xml</nowiki>
  
  
Line 59: Line 59:
  
  
-<code xml+<code json
-<?xml version="1.0" encoding="utf-8"?> +{ 
-<RESPONSE_GROUP PRIAVersionIdentifier="2.4.2"> +    "result": "true" 
-    <REQUESTING_PARTY _Name="TEST SUBMITTER 1_StreetAddress="1001 APEX Submission Ave." _StreetAddress2="" _City="Sub City" _State="CA" _PostalCode="91234" _Identifier="35" /> +}</code>
-    <SUBMITTING_PARTY LoginAccountIdentifier="bzsub1" _Name="AGENT - TEST AGENT 1" /> +
-    <RESPONSE ResponseDateTime="2020-07-23T14:50:24"> +
-        <KEY _Name="Comment" _Value="Sample comment" /> +
-        <RESPONSE_DATA> +
-            <PRIA_RESPONSE _RelatedDocumentsIndicator="true"+
-                <PACKAGE CountyFIPSCode="901" StateFIPSCode="06" SecurityType="1" Priority="Standard"> +
-                    <PRIA_DOCUMENT _Code="Deed" DocumentSequenceIdentifier="1" _UniqueIdentifier="ABC-123" RequestChecksumAlgorithm="SHA384" RequestChecksumValue="0C7580F7-7E3A-4615-A495-55EB66E299A6" ResponseChecksumAlgorithm="SHA384" ResponseChecksumValue="94BE9B16-F97B-4525-BD00-D331F1E7C517"> +
-                        <GRANTOR _FirstName="John" _LastName="Doe" NonPersonEntityIndicator="true" /> +
-                        <GRANTEE _FirstName="Jane" _LastName="Doe" NonPersonEntityIndicator="true" /> +
-                        <RECORDABLE_DOCUMENT> +
-                            <_ASSOCIATED_DOCUMENT _InstrumentNumber="2009003899200" _RecordingDate="2009-02-25" /> +
-                        </RECORDABLE_DOCUMENT> +
-                        <EMBEDDED_FILE _PagesCount="3"> +
-                            <DOCUMENT>SUkqAA7qAAAtVZDKI+R4jhkhyPkfI6I6I4hfI4EGAXI4y4UuyODkcUjg5HA+LkR4uKXyOyOFI4YORcyPl2YiOBgjxHZeL5HIuyPnGR4ui6I6I</DOCUMENT> +
-                        </EMBEDDED_FILE> +
-                        <STATUS _Code="Rejected"> +
-                            <RECORDING_ERROR _Code="99999" _Description="This is a automatic rejection test message." _OfficersName="John Doe" /> +
-                        </STATUS> +
-                    </PRIA_DOCUMENT> +
-                </PACKAGE> +
-                <RECORDING_TRANSACTION_IDENTIFIER _Value="TESTAGENT1-202007140415-00003.1.1" SecondaryValue="3453453453" /> +
-            </PRIA_RESPONSE> +
-        </RESPONSE_DATA> +
-    </RESPONSE> +
-</RESPONSE_GROUP> +
-</code>+
  
  
Line 106: Line 80:
  
 ---- ----
 +
 +
 +**Comment 1:**
 +
 +Following is a C# / .NET sample code snippet that shows how to call the web services associated with deleting a payload.
 +
 +The payloads:delete_payload web service is used as part of the retrieve payload process flow.
 +
 +Payloads that are 'Retrieved' must be locked before they can be retrieved. If the retrieval is successful and any validation requirements are satisfied, then the remote payload can be deleted with the payloads:delete_payload web service, otherwise the payload can be unlocked using the unlock operation as documented in the  [[guides:ws_payloads_lock_unlock_finalize|payloads:lock_unlock_finalize_payload]] documentation.
 +
 +
 +<code C#>
 +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);
 +}
 +</code>
 +
 +
 +**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
 +
 +
 +
  
guides/ws_payloads_delete_payload.1598230285.txt.gz · Last modified: by brett.zamora