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 yassinsiouda74165 Deno
Verified 376 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