InfinitySigner | Posts: 12

Remove Authorization document case-by-case

0 votes
Sometimes (not always, depends on situation) we want to remove the default Authorization document. I would like to know how to do it with REST API using JSON and http calls to the server. In VB.NET we do this as follows: referenceToPackage = eslClient.GetPackage(packageId) Dim loAuthForm As Document = referenceToPackage.Documents(0) eslClient.PackageService.DeleteDocument(packageId, loAuthForm) In VB, we do this before adding our own document for signing. With REST API, we are uploading our document upfront with the signature data in the multipart/form-data post body, so i want to make sure the document I remove is the authorization document, not our document. How would I go about forming the JSON to upload and remove the default authorization document? Thank you! -Joe

Duo_Liang | Posts: 3776

Reply to: Remove Authorization document case-by-case

0 votes
Hi there, Because authorization document is with ID of "default-consent", so it's easy to locate with ID and you won't delete your own documents by mistake as long as you avoid setting this ID. You can use below API:
DELETE /api/packages/{packageId}/documents/default-consent
In your vb code, you can also check the document ID with "default-consent" in case deleting the wrong document. Hope this could help! Duo

InfinitySigner | Posts: 12

Reply to: Remove Authorization document case-by-case

0 votes
Duo - Thank you. When I send the DELETE http call (nothing in the body, just the url as you defined) I get this response: URL: https://sandbox.esignlive.com/api/packages/vtxWKW1JhMTXzdK86OcAsOQI7pE=/documents/default-consent RESPONSE: {"messageKey":"error.validation.cannotDeleteDocumentInActivePackage","message":"The document is in an active package and cannot be deleted.","code":400,"name":"Validation Error"} any ideas?

Duo_Liang | Posts: 3776

Reply to: Remove Authorization document case-by-case

0 votes
Hi there, Please make sure your package is in DRAFT status, you can have this done in this process: #1. create package with multipart/form-data content. And in your payload JSON, set "status":"DRAFT" #2.delete default-consent document #3.sent package by PUT /api/packages/{packageId} with payload of {"status":"SENT"} Hope this could help! Duo

InfinitySigner | Posts: 12

Reply to: Remove Authorization document case-by-case

0 votes
Perfect, thank you! My test package JSON had the status set to "SENT" not DRAFT (I thought it was, but it wasn't). Once I set it to DRAFT first, yes it works to allow me to delete the document then change status to SENT. Thank you again! -Joe

Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off