Edit from the API doesn't trigger a sync (no shock i guess)

I think I know the answer, but I figured I'll double check.

I had gotten myself under the impression (I think by misreading this post from GreenFlux) that calling the AppSheet API to do an Edit would cause a client to sync. (I guess, how would it know... fair enough.) 

Am I correct that if I use the Appsheet API to make edits, the app will still not sync until another action of some kind causes the sync?

Assuming I am correct, I'm not sure why I should use the API to do the edits instead of making them directly to the backend. Is there any practical distinction to me editing some records directly in my google sheet, rather than via the API, since even if I update via the API, the client will be out-of-sync until some other activity forces it?

Apologies for wrapping  myself a bit around the axle. I know it's pretty common for people to want to make external updates and come up empty. Just trying to understand the decisions/tradeoffs I need to make. 

Billy

Solved Solved
0 8 141
1 ACCEPTED SOLUTION

Steve
Platinum 4
Platinum 4

@billyfw wrote:

In general, my question was really: when I directly update the sheet (without the API), I find that the values I update still sync when some user action causes a sync. So I don't see too much resulting difference in making the edit directly vs. using the API. 


Using the API will apply all of the configuration you've given your app: default values, data validation, access control, actions, bot triggers, etc. Manual changes offer none of that--unless you use External Eventing (which only triggers bots).

View solution in original post

8 REPLIES 8

(I know it's not ideal to make edits externally and all that -- but I can't reasonably recreate [and subsequently maintain] the logic to do the updates inside of AppSheet, even if it were theoretically possible, which I'm not sure it is.)


@billyfw wrote:

I had gotten myself under the impression (I think by misreading this post from GreenFlux) that calling the AppSheet API to do an Edit would cause a client to sync. (I guess, how would it know... fair enough.) 



@GreenFlux wrote:

There are two limitations here:

  1. There’s no way to force a sync on another device. Either the user syncs, or wait for background sync.
  2. Edits to the Sheet via Google Forms will not trigger anything in AppSheet. The edit has to be made through the app or API to trigger other logic/actions like a notification.


@billyfw wrote:

Assuming I am correct, I'm not sure why I should use the API to do the edits instead of making them directly to the backend. Is there any practical distinction to me editing some records directly in my google sheet, rather than via the API, since even if I update via the API, the client will be out-of-sync until some other activity forces it?


Sync: Between the app and the backend - AppSheet Help
Errors and warnings during Sync - AppSheet Help

SkrOYC_0-1663876705222.png

Your API calls are related to a data change?

Yes, I was calling a single API edit call with a handful of rows, each with two fields - the key and the value I wanted to change. 

(I do realize I misread @GreenFlux's post - that was my bad. It was clear when I went back and read it. Maybe I just read what I wanted to read :)). 


@billyfw wrote:

Yes, I was calling a single API edit call with a handful of rows, each with two fields - the key and the value I wanted to change


It's not clear what and how you do it

Sorry, I wasn't sure what you were looking for me to clarify. 

This is the body of the API call I sent from outside the app: 

audit.jpg

This was just me testing a modification on this table. For my test, I had a Table view open for APP_PUSH_NOTIFICATION_LOG, which is a listing of notifications. 

The table has a key and a field NotificationText. 

The value of the row for this key started with NotificationText "foo", and I then made this API call to change it to "1234". 

Obviously (in retrospect), the table just sat there until I clicked into some other rows and made modifications, at which point the 1234 synced in as the new value. 

I think, based on your reply, perhaps the specifics of the sync matter to try to predict when and how the app will sync itself after the API call? 

In general, my question was really: when I directly update the sheet (without the API), I find that the values I update still sync when some user action causes a sync. So I don't see too much resulting difference in making the edit directly vs. using the API. 

Does that make sense? Sorry I wasn't clear before.

 

Steve
Platinum 4
Platinum 4

@billyfw wrote:

In general, my question was really: when I directly update the sheet (without the API), I find that the values I update still sync when some user action causes a sync. So I don't see too much resulting difference in making the edit directly vs. using the API. 


Using the API will apply all of the configuration you've given your app: default values, data validation, access control, actions, bot triggers, etc. Manual changes offer none of that--unless you use External Eventing (which only triggers bots).

Okey doke, thanks guys. 

Top Labels in this Space