neelsp | Posts: 77

retrieve list of layouts using API

0 votes
Hi, 1) Is there any API to retrieve list of Layouts for a given sender 2) is there any API to retrieve list of package Ids for a given sender thanks Neel

Duo_Liang | Posts: 3776

Reply to: retrieve list of layouts using API

0 votes
Hi Neel, To retrieve these information, you need to get your sender's api key, and use this api key to call apis just like what you did with your main owner account. Following are the detailed steps: 1. Retrieve sender's api key: First you'd retrieve the sender id by:
GET https://sandbox.esignlive.com/api/account/senders
Then, once you have the sender id of each, you can use api below to retrieve the api key of the current sender.
GET https://sandbox.esignlive.com/api/account/senders/{senderId}/apiKey 
2.Retrieve list of layouts:
GET /api/layouts?from={fromPage}&to={toPage}
3. Retrieve list of package ids: You can use completion report feature to retrieve all senders' package ids (in this way you don't necessary to get the sender's api key)
GET /api/reports/completion?status={status}&from={fromPage}&to={toPage}
Or, you can retrieve packages for this specific sender:
GET /api/packages?query={status}&from={fromPage}&to={toPage}
Hope this could help you! Duo

neelsp | Posts: 77

Reply to: retrieve list of layouts using API

0 votes
Thanks Duo. Is there a way to retrieve the layout using Layout Name instead of from & to? Searching through the list will be time consuming and adds to the over API SLAs Can we do the same for Package & Templates as well? please let us know.

Duo_Liang | Posts: 3776

Reply to: retrieve list of layouts using API

0 votes
Hi Neel, Yes, OneSpan Sign gives you the capability to filter retrieved results. You can add a &search={keyword} parameter to your API call, but I believe you have to keep the from&to, because otherwise you won't retrieve the actually list.(You can only retrieve one package/layout from my test) Following are detailed API calls I suggest to use: For Retrieve Packages:
GET /api/packages?search={keyword}&from={fromPage}&to={toPage}
For Retrieve Templates:
GET /api/packages?type=TEMPLATE&search={keyword}&from={fromPage}&to={toPage}
For Retrieve Layouts:
GET /api/layouts?search={keyword}&from={fromPage}&to={toPage}
As you may noticed: 1. Template is a kind of package with type of "template" 2.in url, {keyword} and {type}(template here) are not case sensitive. Unlike status of the package for example "DRAFT" or "SENT", these must be upper case. Hope this could help you! Duo

neelsp | Posts: 77

Reply to: retrieve list of layouts using API

0 votes
Thanks Duo. So, will it search for shared layouts or just the layouts owned by the sender / apikey? /api/layouts?search="Sample for contract"&from=1&to=100

Duo_Liang | Posts: 3776

Reply to: retrieve list of layouts using API

0 votes
Hi Neel, I believe all APIs above are all apikey based except the following one. If you want to retrieve packages/layouts for your senders, you need to retrieve their apikeys first.
GET /api/reports/completion?status={status}&from={fromPage}&to={toPage}
But unfortunately, we don't provide "search" or "type" parameter in Retrieve Completion Report API, which means you can't add a filter for name or retrieve templates by calling this API. And BTW, in "search" parameter, you don't need to use double quotation marks./api/layouts?search=Sample for contract&from=1&to=100 is fine. Hope this could help you! Duo

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