Forum Discussion
steve
03-04-2025Sisense Employee
Hi francoisvv
We're hoping to add some things in future that could make some of this easier, but for now if you're using React then you can try using useFetch with /api/datasources/<modelname>/fields/search API
Here's a quick / basic example, hope it helps
import { useFetch } from "@sisense/sdk-ui";
import { measureFactory } from "@sisense/sdk-data";
const CodeExample = () => {
const { data, isLoading, error } = useFetch<unknown, Error>(
"api/datasources/Sample%20ECommerce/fields/search",
{
method: "POST",
body: JSON.stringify({
offset: 0,
count: 50,
}),
}
);
data && console.log(data);
return (
<>
{data &&
data.map((row) => (
<p>
Table: {row.table}, Dim: {row.id}, Title: {row.title}
</p>
))}
</>
);
};
export default CodeExample;