Get item list from a NocoDb table

Fetch the nocodb api and return the items of the selected table

Script nocodb Verified

by yassinsiouda74165 ยท 5/21/2023

The script

Submitted by hugo989 Typescript (fetch-only)
Verified 5 days ago
1
//native
2

3
type Nocodb = {
4
  apiUrl: string;
5
  xc_token: string;
6
  table: string;
7
  workspace: string;
8
};
9
export async function main(nocodb: Nocodb, limit: number) {
10
  // request from nocodb
11
  const res = await fetch(
12
    `${nocodb.apiUrl}/api/v1/db/data/v1/${nocodb.workspace}/${nocodb.table}?limit=${limit}`,
13
    {
14
      headers: {
15
        "Content-Type": "application/json",
16
        "xc-token": nocodb.xc_token,
17
      },
18
    },
19
  );
20
  const data = await res.json();
21
  return data;
22
}
23

Other submissions
  • Submitted by yassinsiouda74165 Deno
    Created 397 days ago
    1
    type Nocodb = {
    2
      apiUrl: string;
    3
      xc_token: string;
    4
      table: string;
    5
      workspace: string;
    6
    };
    7
    export async function main(nocodb: Nocodb, limit: number) {
    8
      // request from nocodb
    9
      const res = await fetch(
    10
        `${nocodb.apiUrl}/api/v1/db/data/v1/${nocodb.workspace}/${nocodb.table}?limit=${limit}`,
    11
        {
    12
          headers: {
    13
            "Content-Type": "application/json",
    14
            "xc-token": nocodb.xc_token,
    15
          },
    16
        },
    17
      );
    18
      const data = await res.json();
    19
      return data;
    20
    }
    21