Retrieve package using apex sdk

0 votes

Hello, We have integrated our salesforce application with onespan using APEX SDK.

We want to publish a daily report on the status of the packages that was last updated on 'Yesterday'. I see as per documentation we have to use Retrieve List of Packages feature for the same (

I didnt find the definition of the method: getPackages on our org or on the onespan documentation, could you please provide the same?

Reply to:

0 votes



 we tried this option, and seems like i am not able to query the packages created by other senders. For example, we have a sandbox account where admin is: '[email protected]' and also there is another sender: When i query the package through apex class, i can retrieve packages created by '[email protected]' but not the ones created by Could you please let us know how to solve this?

Reply to: Retrieve package using apex sdk

0 votes

Hi Anway,


From API's perspective, the API behind this function is package retrieval API "GET /api/packages", which can only return packages created by current API Key holder. Which in order to get the packages created by a sender, you have to use his/her API Key instead.

Although your account owner's can access the package with owner's API Key, those packages won't be returned by the package retrieval API, as you've observed.

Considering the APEX SDK is not very friendly if you want to read the API Key from dynamic entities (unless changing the source code), a quick workaround could be use another API: Completion Report API (GET /api/reports/completion?status={status}&from={date}&to={date})

This API returns packages created by all senders, but there's a limitation that it only returns the 100 packages, and there's no way to paginate.

You can find the sample code in the guide here.






Duo Liang OneSpan Evangelism and Partner Integrations Developer

Reply to: Retrieve package using apex sdk

0 votes

Hello Duo,

Thanks for your response.

Our requirement was to send a report to each sender regarding their In progress transactions, for example, the report will say who has completed signing and who has not, also who is yet to upload additional attachments, so that the rep can follow up with the signers accordingly (i have attached a sample report email for your reference, used the getPackages operation that you provided earlier to fetch the details and parse through it to generate this report).

I had a quick look at the completion report, seems we wont be able to query each package one by one to come up with such report with this operation. Could you please confirm on the same?

Also could you please share, is there any way we can still use getPackages(new Map<String,String>{'lastUpdatedStartDate'=>queryDateStr,'lastUpdatedEndDate'=>queryDateStr,'from'=>'0','to'=>'100','query'=>'SENT'}) operation to achieve the same, how can we get the user's api key, i thought api key is tied to the environments and not with senders.

Additionally, could you please share your calendar details to have a quick call on the same?



Anway Kabir


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