Get all Trashed packages
Thursday, January 17, 2019 at 06:05amIs there a way to retrieve a list of packages in the Trash folder using Java SDK? I understand Trashed is a property not a package status. But I need to purge all packages that are trashed. Getting a completion report on the package status such as Completed, Archived, Declined, etc does not return packages where trashed=true.
Reply to: Get all Trashed packages
Thursday, January 17, 2019 at 06:11amGET /api/packages?query=trashed
And I can definitely create some sample codes for you by making REST calls. I will post in this thread within few minutes. Hope this could help! DuoReply to: Get all Trashed packages
Thursday, January 17, 2019 at 06:38amReply to: Get all Trashed packages
Friday, October 2, 2020 at 09:26amHello Duo_Liang.
Im interested on getting the transactions trashed on the account (from all users) and runned into this post.
When I use the eslClient.ReportService.DownloadCompletionReport I iterate throw all senders and get all the packages, execept the the TRASHED.
I thought that this post was the answer, but according to the script you shared, doing the "REST API: GET /api/packages?query=trashed" I only getting the packages from the administrator. How can I get all trashed packages from all users using the REST API?
Thanks in advanced.
Reply to: Hello Duo_Liang. Im…
Friday, October 2, 2020 at 11:23amHi Asimao,
If you are currently using completion report function and be aware that the Completion Report can at most return 100 packages within the time range, there's an easier way to get all trashed packages.
Although "Trashed" is not a package status, it's listed as a valid parameter value in the Completion Report API:
And below code allows you to create a custom status Enumeration (although the function has been deprecated and not suggested to be used):
PackageStatus trashed = PackageStatus.UNRECOGNIZED("trashed");
......
// Download the completion report for all senders
CompletionReport sdkCompletionReport = eslClient.getReportService().downloadCompletionReport(trashed, from, to);
A more thorough solution is to use package retrieval API instead. But as you've mentioned, it only returns packages created by the API Key holder. So you need to first retrieve API Keys of each senders, then retrieve their respective trashed packages. I've open sourced my Package Download and Export Tool where you can find the relevant code sample there. Let me know if you need further assistant to go down this path.
Duo
Reply to: Get all Trashed packages
Friday, October 2, 2020 at 01:06pmHello, thanks for the reply
"A more thorough solution is to use package retrieval API instead. But as you've mentioned, it only returns packages created by the API Key holder. So you need to first retrieve API Keys of each senders, then retrieve their respective trashed packages...."
Not a solution having to retrieve API Keys of each senders.
The completionReport solution you recomended, seemed more friendly. I know trashed is a attribute and not a Status, but for CompletionReport effects I think is the best aproach, getting all transactions form all senders.
So the aproach
"PackageStatus trashed = PackageStatus.UNRECOGNIZED("trashed");
// Download the completion report for all senders
CompletionReport sdkCompletionReport = eslClient.getReportService().downloadCompletionReport(trashed, from, to);
"
seem to be the best but Im not getting the PackageStatus.UNRECOGNIZED("trashed"); using C# and SDK (11.23.0.0).
Can you help?
Reply to: Hello, thanks for the reply …
Friday, October 2, 2020 at 02:11pm.NET SDK doesn't expose the function to initialize a customized package status instance, so I guess reflection has to be used here:
public static T Construct<T>(Type[] paramTypes, object[] paramValues)
{
Type t = typeof(T);
ConstructorInfo ci = t.GetConstructor(
BindingFlags.Instance | BindingFlags.NonPublic,
null, paramTypes, null);
return (T)ci.Invoke(paramValues);
}
Type[] paramTypes = new Type[] { typeof(string), typeof(string), typeof(int) };
object[] paramValues = new object[] { "trashed", "trashed", 7 };
DocumentPackageStatus trashed = Construct<DocumentPackageStatus>(paramTypes, paramValues);
I found the sample code from this StackOverflow post and it works well at my side.
The source code of DocumentPackageStatus class can be found here.
Duo
Reply to: .NET SDK doesn't expose the…
Friday, October 2, 2020 at 04:37pmThanks a lot Duo Liang!
It worked.
About the limitations of 100 transactions in DownloadCompletionReport, I read in a post of Fev2019 (https://community.onespan.com/forum/retrieve-completion-list-limitation) that you answered
"Hi guys, "The limitation of return 100 results" exists on all GET requests querying list from OneSpan Sign, it's due to the internal workings of OSS. In future, there'll be a new report API returning summary data of more than 100 results, which will be the best solution to this post"
Is there any date planned for the vew report API with more then 100 results?