GoncaloTryOut

Update Package from Draft to Sent Postman

1 votes

Hey guys, 


I'm trying to put together the following flow:

  1. Create a Package through Postman using the following payload.
  2. Add a document through a azure function (Its working).
  3. Update Package from Draft to Sent by making a Put request with only { "status": "SENT" }.

The last step always returns 

{

    "messageKey": "error.validation.sendPackage.noApprovals",

    "message": "Cannot send package without approvals.",

    "code": 400,

    "name": "Validation Error"

}

For example Updating the package name works perfectly fine. 

Updating signers returns code 200 but It doesn't update their emails.

 

I would like to know what is missing from my main payload in step 1 or what can I add in step 3 to be able to change from Draft to Sent. Also how can I make a put request that changes a signers characteristics ?


Reply to: Update Package from Draft to Sent Postman

1 votes

Hi Goncalo,

 

As per the error message "Cannot send package without approvals", it seems you didn't add any signature(approval) to the package, neither in step 1 or 2.

The link points to your payload seems to be broken, would you mind sharing it to [email protected] so that I can take a closer look at it? Also, not sure how you uploaded the documents through the azure function in step2, could you elaborate it a little bit more?

And in order to update signer email (or any other signer level attributes), you'd ping a more fine-grained API endpoint. (PUT /api/packages/{package_id} call will ONLY update package level attributes, like package timezone, language, settings, name, description, etc) 

 

Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: Update Package from Draft to Sent Postman

0 votes

Hi Duo,

Payload corrected link -> https://pastebin.com/BFgtJZ9M

Ok so, my objective is to create a custom connector for Microsoft Flow so I can integrate your OneSpan Sign with Document Libraries in Sharepoint Online.

My first obstacle was sending a form-data request which custom connectors on Microsoft Flow don't allow. (By the way is it possible to send a document through application/json and if yes how is the format?)

So my solution was to divide the flow:

  1. Postman collection which creates a package through a simple POST request.
  2. Add a document to a specific package through a .NET function similar to this https://www.onespan.com/blog/onespan-sign-new-users-how-create-and-send-your-first-package-rest-api
  3. Update package from DRAFT to SENT also through a postman collection.

I believe that after reading your response I'm missing a step here where I need to add approvals? Like It shows here https://community.onespan.com/products/onespan-sign/sandbox#/Approvals/api.packages._packageId.documents._documentId.approvals.post ? For every document uploaded an approval must be added ?

 


Reply to:

0 votes

Hi Goncalo,

 

For invoking multipart/form-data request in Microsoft Flow, not sure if this post helps where it suggests to use a special JSON syntax:
https://powerusers.microsoft.com/t5/Connecting-To-Data/Send-multi-part-form-data-with-flow-HTTP-task/m-p/412066#M7102

 

For the questions:

# Is it possible to send a document through application/json and if yes how is the format?

I'm afraid the answer is No. No matter you are uploading document binary in package creation call, or later through a document upload call, the request type has to be multipart/form-data (if you are creating a package with request type of application/json, OneSpan Sign system won't expect the call to include "documents")

So if you can share a package ID with me, I can help you check if the document was successfully uploaded (which I am a bit worried about).

 

# missing a step here where I need to add approvals for every document uploaded

If a document doesn't contain any approval, then this document will be review only. But you can't have all documents review-only and there should be at least one document containing signature(s).

 

Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: Update Package from Draft to Sent Postman

0 votes

Hey Duo,

Yeah I was almost sure that It wouldn't be possible to do it by JSON. It's okay tho, I can add a document to a specific package through the .NET function. I'll be adding the approval step before submitting the documents for signing. 

Thank you for your help! 


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