Identifying updated records using API [Aug 09]

:raising_hand_man: ccoli asked

Hi~ Is there any way to detect record updated on code without using webhooks ?

I just do not know how to do that. I just come up with the idea doing something with nocodb-sdk but still do not know how to do that.

```

const router = require(‘./routes’);

(async () => {

// require express

const app = require(‘express’)();

// require nocodb

const { Noco } = require(‘nocodb’);

app.set(‘port’, process.env.PORT);

// mount nocodb as a middleware

app.use(‘*’, router);

app.use(await Noco.init({}));

console.log(Visit : localhost:${process.env.PORT}/dashboard);

// listen to a port

app.listen(process.env.PORT);

})();

```

:man_bald: dstala replied

Webhook is ideal way. If you wish to do it using API, it can be done via polling periodically & conditionally retrieving records from a table based on updated-at timestamp range.

:raising_hand_man: ccoli replied

thank you <@857998597474484295> for ur reply. but polling is a bit different that I wish to do.

the thing I wish to do is the below.

“deal” table has “cpid”, “subject” columns and some defaults columns as well.

1. update cpid column (cpid is just an example column) on nocodb

2. fetch some data with cpid

3. update the record with data fetched on subject.

without using webhooks, so far is there any way ??

I’m justing thinking this way can u tell me if this ok or not??

After updating record, there is an post api with payload.

so on the routing, I catch the payload and somehow call the api to fetch the subject data.

and with the subject data. I update the record.

but I’m not sure if this is possible and ok to do it.

:man_bald: dstala replied

without using webhook, this would become tedious I believe.

> so on the routing, I catch the payload and somehow call the api to fetch the subject data.

> and with the subject data. I update the record.

So if you are manually adding a patch for a particular table, it might work as long as the API invocation parameters are correct. not recommended though - as it would be pretty much a hack;

Autogenerated from discord


Join NocoDB’s community

DiscordTwitterRedditDocs