This topic contains 1 reply, has 2 voices, and was last updated by  Duo_Liang 3 weeks, 1 day ago.

  • Author
    Posts
  • Participant
    SamiraJavdani
    Member since: 22.10.2018
    Number of posts: 3

    Hi,

    I would like to get all the layout’s ids .

    When I do a GET /layouts, I only get the layouts for the admin not for all senders.

    How can I list all the layouts from all senders in the account?

    Thanks.

    Keymaster
    Duo_Liang
    Guru
    Member since: 14.06.2018
    Number of posts: 766

    Score

    0

    Hi Samira,

    Because Layout/Template should only be visible to their owner (except shared ones), so I’m afraid there’s no direct API call retrieving layouts from all senders.
    But since it’s account/API_KEY binded, you’d first retrieve all senders’ api keys then get layout IDs for them each, in below workflow:
    (1) retrieve all sender list, guide here:

    HTTP Request
    GET /api/account/senders?from=1&to=100
    
    HTTP Headers
    Accept: application/json
    Content-Type: application/json
    Authorization: Basic api_key

    (2)retrieve sender’s api key (same Senders guide):

    HTTP Request
    GET /api/account/senders/{senderId}/apiKey
    
    HTTP Headers
    Accept: application/json
    Content-Type: application/json
    Authorization: Basic api_key
    
    Response Payload
    {
        "apiKey": "XXXXXXXXXXXXX=="
    }

    (3) put the sender’s api key in request header and retrieve layout ids (guide here):

    HTTP Request
    GET /api/layouts?summary=true&from={fromPage}&to={toPage}
    
    HTTP Headers
    Accept: application/json
    Content-Type: application/json
    Authorization: Basic {sender_api_key}

    Just note that,
    * “summary=true” this parameter would hide some part of the return result and reduce the response time
    * this call returns you all shared layouts, so there’s overlaps if you did the same call to all senders. You probably want to have a filter to the return results on “sender” node and check the owner’s email with the current api key’s account.

    I understand that it’s a complex workflow, so if you told me your programming language, I can create some sample code for you.

    Hope this could help!
    Duo


    Duo Liang
    OneSpan Junior Technical Evangelist
    • This reply was modified 3 weeks, 1 day ago by  Duo_Liang.

You must be logged in to reply to this topic.