This topic contains 4 replies, has 2 voices, and was last updated by  InfinitySigner 4 weeks ago.

  • Author
    Posts
  • Participant
    InfinitySigner
    Newbie
    Member since: 17.01.2019
    Number of posts: 6

    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

    Keymaster
    Duo_Liang
    Guru
    Member since: 14.06.2018
    Number of posts: 644

    Score

    0

    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


    Duo Liang
    OneSpan Junior Technical Evangelist
    Participant
    InfinitySigner
    Newbie
    Member since: 17.01.2019
    Number of posts: 6

    Score

    0

    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?

    Keymaster
    Duo_Liang
    Guru
    Member since: 14.06.2018
    Number of posts: 644

    Score

    0

    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


    Duo Liang
    OneSpan Junior Technical Evangelist
    Participant
    InfinitySigner
    Newbie
    Member since: 17.01.2019
    Number of posts: 6

    Score

    0

    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

You must be logged in to reply to this topic.