TRex

Two ways to change status to DRAFT?

0 votes
I was successfully able to change my package status to DRAFT by using the code supplied in your guide. See below:
EslClient eslClient = new EslClient(api_key, api_url);
eslClient.changePackageStatusToDraft(packageId);
However, I also noticed there is another way to update the package status:
PackageId packageId = new PackageId("MY_PACKAGE_ID");
DocumentPackage package1 = eslClient.getPackage(packageId);
package1.setStatus(PackageStatus.DRAFT);
eslClient.updatePackage(packageId, package1);
Do these two methods have the same effect? Or is one preferred over the other?

Reply to: Two ways to change status to DRAFT?

0 votes
Hi TRex, Yes, these two methods have the same effect. Generally speaking, we suggest to use the first method supplied in the guidance. Because #1, first way is more intuitive #2, first way only yields one API call(one POST request) while second way sends two API calls to achieve the same goal. (one GET request and one POST request) Of course second way already obtained the package object for further usage, but that really depends on your use case, and not all the scenarios you need to grab package object, right? So that's why we still recommend the way used in guide and hope this could help you! Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


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