Using Odata to import submission from ODK Central

I'm trying to import the Form Submissions from ODK Central using the odata link.

As a frontend, I'm using React js and unable to fetch the submissions. I have tried using the token authentication too.

Sample code is as under:

import odataProvider, { OdataDataProvider } from "ra-data-odata-server";

function App() {
  const [dataProvider, setDataProvider] = useState<OdataDataProvider>();
  useEffect(() => {
    odataProvider(
      "https://myodkcentralurl-submissions.svc/"
    ).then((p) => setDataProvider(p));
    return () => {};
  }, []);

  return dataProvider ? (
    <Admin dataProvider={dataProvider}>
      {dataProvider.getResources().map((r) => (
        <Resource
          key={r}
          name={r}
          list={ListGuesser}
          edit={EditGuesser}
          show={ShowGuesser}
        />
      ))}
    </Admin>
  ) : (
    <Loading></Loading>
  );
}

Objective is to fetch the submissions and create dashboard elements and MIS tables.

1 Like