List

The List API returns children of a directory, including HTML documents, JSON files, media files (images, PDFs, SVG), and subdirectories.

GET

Parameters

Headers

https://main--docket--da-pilot.aem.live/fragments/api/headers

Path

https://main--docket--da-pilot.aem.page/fragments/api/path

Examples

Request

  • curl (bash)
  • Javascript
curl -X GET \
  'https://admin.da.live/list/geometrixx/outdoors/drafts/cmillar' \
  --header 'Authorization: Bearer {IMS_TOKEN}'
async function listDirectory(org, repo, path) {
  const response = await fetch(
    `https://admin.da.live/list/${org}/${repo}/${path}`,
    {
      method: 'GET',
      headers: {
        'Authorization': `Bearer ${IMS_TOKEN}`,
        'Accept': 'application/json'
      }
    }
  );

  if (response.status === 401) {
    throw new Error('Authentication failed');
  }

  if (!response.ok) {
    throw new Error(`HTTP ${response.status}`);
  }

  return await response.json();
}

// Usage
const items = await listDirectory('geometrixx', 'outdoors', 'drafts/cmillar');

// Separate files and folders
const files = items.filter(item => item.ext);
const folders = items.filter(item => !item.ext);

// Filter by file type
const htmlFiles = items.filter(item => item.ext === 'html');
const jsonFiles = items.filter(item => item.ext === 'json');
const images = items.filter(item =>
  ['png', 'jpg', 'jpeg', 'svg'].includes(item.ext)
);
const pdfs = items.filter(item => item.ext === 'pdf');

Response

  • 200 (json)
[
  {
    "path": "/geometrixx/outdoors/drafts/cmillar/hello-world.html",
    "name": "hello-world",
    "ext": "html",
    "lastModified": 1757431019568
  },
  {
    "path": "/geometrixx/outdoors/drafts/cmillar/data.json",
    "name": "data",
    "ext": "json",
    "lastModified": 1770501998955
  },
  {
    "path": "/geometrixx/outdoors/drafts/cmillar/hero.png",
    "name": "hero",
    "ext": "png",
    "lastModified": 1752157064320
  },
  {
    "path": "/geometrixx/outdoors/drafts/cmillar/guide.pdf",
    "name": "guide",
    "ext": "pdf",
    "lastModified": 1756153846691
  },
  {
    "path": "/geometrixx/outdoors/drafts/cmillar/subfolder",
    "name": "subfolder"
  }
]

Note: Files have ext property. Folders do NOT have ext - this is how you identify them. The lastModified is a Unix timestamp in milliseconds.

Empty folder or non-existent path: Returns [] (empty array) with HTTP 200. No way to distinguish empty vs non-existent.

401 Unauthorized: Returns empty body with HTTP 401