SamiraJavdani | Posts: 6

Call to Get all layout IDs for all senders

0 votes
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.

Duo_Liang | Posts: 3776

Reply to: Call to Get all layout IDs for all senders

0 votes
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

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