Flatten mixed media API responses into rows for a Retool review table

Disclosure: I develop EasyDown, the API used in this example. AI helped draft this post. The JavaScript adapter below was checked with local fixtures; I have not tested it inside a live Retool app.

A media review table has a small but awkward modeling problem: one post can return images, several video qualities, and separate audio. A single “download URL” column hides those differences. I would keep the API response and the table model separate, then build one review row per available media item.

This is an integration design note, not a completed Retool app or an exported template. The example targets public single-post URLs that the caller has permission to process. It does not implement profile crawling, private-post access, or bulk downloading.

Keep the request boundary separate

The API request is a POST to https://api.easydown.org/api/v1/parse, with a JSON url field and Bearer authentication. Keep the API key in the server-side resource configuration rather than copying it into a table component or a frontend variable. Confirm your workspace's resource and permission settings before connecting production credentials.

EasyDown's API uses credits and paid plans; its free browser downloader is a separate product. For supported platforms and current request fields, see the EasyDown video downloader API reference.

Pass the parsed JSON body to the adapter. If your query adds a wrapper, unwrap it first. The resulting array is the proposed table data model; actual component bindings still need checking in Retool.

Flatten collections without inventing metadata

The normalized successful response has status: 200 and a data object containing media collections. The function below accepts that envelope and returns a flat array. An absent collection is treated as empty. A failed envelope throws a generic error instead of returning a misleading empty success table.

// Locally verified adapter for a successful EasyDown normalized response.
// No network requests, media downloads, API keys, or billing decisions.
function mediaRows(response) {
  if (response?.status !== 200 || !response.data ||
      typeof response.data !== 'object' || Array.isArray(response.data)) {
    throw new Error('Expected a successful normalized media response');
  }
  const positive = n => typeof n === 'number' && Number.isFinite(n) && n > 0 ? n : null;
  const text = value => typeof value === 'string' ? value : '';
  const rows = [];
  for (const [collection, kind] of [['images', 'image'], ['videos', 'video'], ['audios', 'audio']]) {
    const items = response.data[collection];
    if (!Array.isArray(items)) continue;
    items.forEach((item, index) => {
      if (!item || typeof item !== 'object') return;
      let parsed;
      try {
        if (typeof item.url !== 'string') return;
        parsed = new URL(item.url);
      } catch { return; }
      if (!['https:', 'http:'].includes(parsed.protocol) || parsed.username || parsed.password) return;
      rows.push({
        id: `${kind}:${index}`,
        kind,
        quality: text(item.quality),
        width: positive(item.width),
        height: positive(item.height),
        audio: kind !== 'video' ? 'n/a' : item.hasAudio === true ? 'included' :
          item.hasAudio === false ? 'not included' : 'unknown',
        // Preserve signed query strings exactly; do not log full URLs in production.
        mediaUrl: item.url,
      });
    });
  }
  return rows;
}

video:0 is a row key within one response. It is not a durable identity across different posts or later parsing attempts. If a review table combines multiple jobs, namespace these IDs with your own job ID.

The URL check only validates syntax, scheme and the absence of embedded credentials. It is not an SSRF defense or a determination that the destination is safe or public. This adapter does not fetch any media.

Review uncertain fields explicitly

For example, this synthetic payload exercises each media collection without calling a service:

const fixture = { status: 200, data: {
  images: [{ url: 'https://example.com/poster.jpg', width: 1080, height: 1920 }],
  videos: [
    { url: 'https://example.com/clip.mp4', quality: '720p', hasAudio: false },
    { url: 'https://example.com/another.mp4' }
  ],
  audios: [{ url: 'https://example.com/sound.m4a', quality: '128kbps' }]
} };
console.table(mediaRows(fixture));

The result contains four rows:

id kind quality width height audio
image:0 image 1080 1920 n/a
video:0 video 720p not included
video:1 video unknown
audio:0 audio 128kbps n/a

A video without hasAudio stays “unknown.” A video marked false gets “not included”; this does not imply a separate audio track exists. Do not infer audio availability from an MP4 extension. Missing dimensions also stay null rather than becoming zero.

For the first iteration, I would show these metadata columns before enabling any media preview. Preserve signed URLs as returned, avoid logging their full query strings, and account for expiry. This adapter is not a full schema validator: an empty result can mean no usable media or an unexpected payload, so inspect that case separately before presenting a “completed” review state.

The local fixture checks covered mixed media, a missing audio flag, malformed collections, rejected URL schemes, embedded URL credentials, and an unsuccessful envelope. No live API request, media download, API credit use, or Retool runtime execution was involved. Row counts do not determine billable units.

For people who have built similar review screens: would you keep all qualities in one table, or use a parent post row with a separate media detail view? That UI choice seems more consequential than automatically picking the first video.

id keep it as one flattened table. scanning and filtering across qualities is the whole point of a review queue, and a parent/detail split just adds a click to every check.